This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Component Checking If the Applet Window is Minimized Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Component Checking If the Applet Window is Minimized" Watch "Component Checking If the Applet Window is Minimized" New topic
Author

Component Checking If the Applet Window is Minimized

Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
I want my custom Awt Components (my own class extending awt.Component) running under Applet be able to tell if the browser window is minimized, put in the background (i.e. no longer the active window) or hidden. I tried Component.isShowing() but it seems that it always return true even if I've minimised the browser window or put it into the background. Is there any other methods I can use?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19684
    
  20

You can get hold of the "browser frame" using SwingUtilities.getAncestorOfClass:
I think that adding a WindowListener to that should work.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Component Checking If the Applet Window is Minimized