Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Two GUIs in one class using netbeans builder

 
Ranch Hand
Posts: 74
Netbeans IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Marshal
Posts: 70254
282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 74
Netbeans IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Marshal
Posts: 70254
282
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 74
Netbeans IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic