How do I get "Goodbye Window" to show up in Java?
I have a Java network application and this is what I want to do: After user logs out, his interface window closes. Now, I want for another window to show up that will say something like: "Thank you for using our application". This final window should be borderless and without any available option, more like a plain picture (jpeg? why not?). By clicking on it, user will be sure to close this final 开发者_如何学Cwindow.
I googled and couldn't fin anything on this matter, it's hard to phrase the question.
I hope someone helps me...
https://docs.oracle.com/javase/1.5.0/docs/api/javax/swing/JWindow.html
A JWindow is a borderless, undecorated JFrame (no titlebar or buttons).
This should be what you need.
This should help:
http://java.sun.com/docs/books/tutorial/uiswing/events/windowlistener.html
You're interested in the windowClosing
and windowClosed
events
You have various possibilities, depending on when you want this dialog to display :
- if you want it to display juste before the app closes, use
addShutdownHook
- if you want it to display when the last window closes, use
addWindowListener
You can then use a JWindow
with your image inside, and use addMouseListener
to wait for the user to click on it.
精彩评论