I am trying to build a user alert mechanism by bringing up the window to the front and then flashing the icon on the screen for the user. I have two questions with regards to this approach:
- How can you find the current window you are at in Java and then de-minimize it and bring to front?
- Is there a mechanism in Java that would enable me to simply show the icon for a second or two and then hide it, in the middle of the screen? If not, what would be the way to achieve that?
Thanks a lot for any replies.
returns arrays of all
Top-Level Containersfrom current JVM e.g.J/Frame,J/Dialog(JOptionPane),J/Window,you can to test for (example)
if (allWindows[i] instanceof JFrame) {then WindowState returned WindowEvent
use undecodated
JDialog(workstoFront,toBack) withcreate only once time
setDefaultCloseOperations(HIDE_ON_CLOSE)use
Swing Timerfor hideJDialogJava Translucent Window, put thereIconto theJLabel(or to theJButton)use
Swing Timerfor flashing by hidingIconor swithing bewtween two or moreIcons(three or four is good)