Thanks its working, iv found JOptionPane.OK_OPTION == 0 in a java book is it better to stick to the one you showed me?? Or doesnt it really matter?? thanks
Joined: Jun 09, 2003
> Is there a way to do this with the standard JOptionPane.showMessageDialog
is there a particular reason for adding an actionListener to the OK button?
you could put the code you plan for the actionEvent immediately after showing the optionPane, and it will be executed as soon as the optionPane closes, but the user can still close the optionPane via 'X' and the 'esc' key, so you may not want the code executed if the optionPane is closed this way.
if what you do is based on user selection, or how user closes the optionPane, the other optionPanes are better
Joined: Sep 26, 2008
It doesn't have be be an action listener, but i do want to be able to distinguish between the OK button and the X button, because they both return a value of 0 when pressed. Is there a another way to distinguish between the X and OK button or must i just create a custom one?? I only want one button the OK button.