0

It seems that making a new JFrame to act as a dialog box isn't the best way to do this as it seems tricky to grab the specific value from the class which creates it.

I basically want to make a dialog box with a large number of buttons, which once a user clicks on one, the main class will grab that value. If I make a frame to do this, getting that value is tricky (but it's much easier to design in Windowbuilder Pro) but it also means the user can still interact with the main frame while this frame is presented.

What's the best way to create such a dialog box?

mKorbel
  • 109,525
  • 20
  • 134
  • 319
user1147964
  • 143
  • 2
  • 11

1 Answers1

1

Use a JDialog or JOptionPane instead. If you want the user to be able to interact with the frame while it is open, it should be non-modal, but then you have the problem of knowing when it is closed in order to get the values.

See also:

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433