Click to See Complete Forum and Search --> : Dialogs


daileyps
September 19th, 2000, 02:57 PM
If I create a dialog box:

int result = JOptionPane.showOptionDialog(MyApp.this, dlgObjects, "MyDialog", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, dlgOptions, dlgOptions[0]);

where dlgObjects are simply my objects (labels, text boxes) and dlgOptions are my buttons:

private Object[] dlgOptions = { "Save", "Cancel") };

How do I:
a) setMnemonic on the two option buttons?
b) trap for enter key and invoke the button with focus?

Thanks in advance :-)

stephen fischer
September 20th, 2000, 10:28 PM
you cannot. JOptionPanes are fairly primative. you will have to build your own JDialogs to get this advanced behavior.