Frage

Is there any way to have a JOptionPane.showMessageDialog pop up when you end the program? I am wanting to display a log of users who have logged into my program during that specific run. I have the code completed for displaying the message, just am not sure as to how to get it to display when the program ends.

Thanks

War es hilfreich?

Lösung

You can either add a listener to whatever event closes the application. You can use a WindowListener to detect when people click the X. Tutorial here: http://docs.oracle.com/javase/tutorial/uiswing/events/windowlistener.html

Or you can look into shutdown hooks.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top