문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top