• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

current window

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
is it possible to determine if the window with my applet is active at the moment?
 
Saloon Keeper
Posts: 28711
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 28711
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic