Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Component Checking If the Applet Window is Minimized

 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can get hold of the "browser frame" using SwingUtilities.getAncestorOfClass:
I think that adding a WindowListener to that should work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic