• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

current window

 
Andrew Lit
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
is it possible to determine if the window with my applet is active at the moment?
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not on a portable (Java == Write Once/Run Anywhere) basis. First, because the applet is USUALLY actually in some sort of framing structure inside some sort of page-display area inside a Browser that controls one or more frame windows (except in Mozilla, there's also tabbed panes!). In some systems, each of these containers qualifies as a type of "window", so you'd have to qualify your search.
Secondly, because the constitution of a "window" varies according to the OS (and browser) being used. Since 100% pure Java is portable, it has no support for OS-dependent constructs. You have to escape out into JNI to latch onto OS-specific resources.
Finally, because while a browser is the most common container for an applet, it's not the only one. With a little work, you could probably run an applet inside an Excel spreadsheet, but the appletviewer program is a very common example of this case.
It can be done, but you have to pretty much abandon portability and invoke JNI to do so. And how you do it would depend on that you plan on doing with the window once you got it.
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Erps, sorry. Vision blurred out. You wanted to know if the window was ACTIVE. Which usually means "has input focus". Usually indicated by some sort of highlighting of the title bar and/or other visual candy. That's also OS dependent, though, so most of what I just said still applies.
 
Andrew Lit
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic