Thursday, July 30, 2009

How can I make a Java function that displays a Swing Frame wait until the user presses OK to return?

I have a function that I don't want to return until the dialog has been dismissed. How can I do that?

How can I make a Java function that displays a Swing Frame wait until the user presses OK to return?
Hi Steve





E.M. Bedd is right, But you can also show a custom frame to the user.


For this you need to inherit the Dialog Class and specify the parent frame. I think this will help you





Good Luck


Anand.
Reply:You just need a java alert box equivalent.





import javax.swing.*; and use





JOptionPane.showMessageDialog( null, "Press OK to continue", "" , JOptionPane.ERROR_MESSAGE);
Reply:try putting the swing frame in a do while loop with the condition the answer.


No comments:

Post a Comment