File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Two GUIs in one class using netbeans builder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Two GUIs in one class using netbeans builder " Watch "Two GUIs in one class using netbeans builder " New topic
Author

Two GUIs in one class using netbeans builder

Ciaran Mooney
Ranch Hand

Joined: Jan 21, 2013
Posts: 72

Hi All,
I am creating a database app using netbeans GUI form builder to display a JTable with DB contents.
When the user wants to add to the DB i want to get input from a separate GUI by the click of a button.
Does anyone no if it is possible to create another JFrame dialog GUI in the same class as the main GUI in netbeans GUI builder?
Thanks
Ciaran


I love deadlines, I love the whooshing sound they make as they fly by...
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38492
    
  23
Not sure whether you really mean “same class”.
Sounds as though you want a dialog to appear. That is not difficult.
Ciaran Mooney
Ranch Hand

Joined: Jan 21, 2013
Posts: 72

Wat i am looking for is something more rubust that can take allot more input fields than a JOptionpane.
So i need another separate GUI called from within the same class as my primary GUI when the 'Add Person' button is selected. So i am wondering is it possible to create two GUIs in one netbeans builder class or maybe i need to create a seperate class with 'get' compent methods to facilitate listening from another class.... Or create a i internal frame..
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1077
    
  10

Whether NetBeans or not, you should look to create 2 GUIs in 2 different classes. You can then call one class from other by creating its instance.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38492
    
  23
Ciaran Mooney wrote: . . . more input fields than a JOptionpane. . . .
You can have much more input than you see in the tutorials, even on an option pane dialogue. The Java Tutorials gives you only a simple start on dialogues.
Ciaran Mooney
Ranch Hand

Joined: Jan 21, 2013
Posts: 72

Thanks.
I got what i needed by creating a array of JConponments (labels and text fields ) and adding this to a JOptionpane.
I didnt realise the JOptpane could take JPanels and jcomponents as arguments and also a JDialog is another top level container like JFrame.
I no i cant add one top level container to another but is there a limit to the number in one class?
 
Don't get me started about those stupid light bulbs.
 
subject: Two GUIs in one class using netbeans builder