• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

current window

 
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?
 
Saloon Keeper
Posts: 22658
153
Android Eclipse IDE Tomcat Server Redhat Java 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: 22658
153
Android Eclipse IDE Tomcat Server Redhat Java 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.
 
This tiny ad is wafer thin:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic