Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiple windows question  RSS feed

 
Ian Dunsirn
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am looking for some advice. I have a windowA with buttonA. I want buttonA to open a new windowB, where I want to enter some data and then press buttonB, which will return control back to windowA (ie, windowB is modal). Can anyone help?

Thanks.
 
Campbell Ritchie
Marshal
Posts: 55687
162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a job for JOptionPaneMan.

Is JOptionPane what you are looking for? Or is it too simple?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WindowB should simply be a JDialog, constructed with the "modal" constructor argument's value as "true".
 
Ian Dunsirn
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ernest Friedman-Hill:
WindowB should simply be a JDialog, constructed with the "modal" constructor argument's value as "true".


What if I want this window to have comboboxes and radio buttons and the like? Can I do that with a JDialog? I'm pretty much a greenhorn as far as Java goes.

* Dunsirn

Additional: The second window is to have some comboboxes, radio buttons and stuff like that. For the moment, I'm just seeing if I can windowA to create windowB and give it the focus. Once buttonB is pressed, I want windowB to close and return the focus to windowA.
[ June 06, 2006: Message edited by: Ian Dunsirn ]
 
Ian Dunsirn
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
Sounds like a job for JOptionPaneMan.

Is JOptionPane what you are looking for? Or is it too simple?


Not really, the new window is to eventually have several radio buttons, input boxes and the like.

* Dunsirn

[ June 06, 2006: Message edited by: Ian Dunsirn ]
[ June 06, 2006: Message edited by: Ian Dunsirn ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ian Dunsirn:


What if I want this window to have comboboxes and radio buttons and the like? Can I do that with a JDialog?


Yup, you can use it in much the same way as JFrame: getContentPane(), then add() things to it.
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Conversely you could set the content pane to whatever component you want to display which could of course contain other components as well.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!