On Aug 7, 9:35 pm, JKid314159 <[email protected]> wrote:
> Dear Java Programmer:
>
> I am trying to log a message but then send it to a pop-up message. When the
> button is click the program continues to run. How can I stop the program
> from running in the background? Must be doing a continuous loop of sorts?
>
> JOptionPane.showOptionDialog(null, "Log Object has been created.\n" +
> "Click Ripet to continue", "WARNING - Froggy!",
> JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
> null, options, options[0]);
I only see two possibilities:
1 - Capture the return value of the button clicked and use an if
which sends System.exit(0)
See here for an example:
http://www.devdaily.com/blog/post/jfc-swing/an-example-of-use-joptionpane-showconfirmdialog-method/
and adapt it to your showOptionDialog following the API:
http://java.sun.com/javase/6/docs/api/javax/swing/JOptionPane.html
But be aware as mentioned in the API Swing is not thread-safe.
2 - Use an application WindowListener which sends EXIT_ON_CLOSE
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---