How to detect if applet lost its focus

is there a possible way to detect if the applet( the browser itself) lost its focus?
ANYONE??????????

it doesnt work for me because i am not using a frame. the applet is embedded in the browser itself.
You're right. i need to use JSObject to call javascript from java. But i'm still having some problems.
win = JSObject.getWindow(this);
str = (String)applet.win.call("myEval", obj);     
the str should return a 'false' if the applet is out of focus and 'true' if the applet is in focus.
This is my javascript:
<script type = "text/javascript">
var winstate = 'true';
function myEval() {
     window.onblur = returnFalse();
     return winstate;
function returnFalse(){
     winstate = 'false';     
function returnTrue(){
     winstate = 'true';
</script>
you know what happens? it always returns 'false' even though the applet is in focus! i don't understand what am i doing wrong. Please help. I am stuck on this.

Similar Messages

  • Applet looses its focus in IE

    Hello, all!
    I working with applet that will be used as a simple code editor with highlighting of different programming languages.
    This applet based on JTextPane wrapped in JScroll pane. When I test this applet with java applet viewer - all works fine, but now I embedded my applet into html page and try to test it in "live" conditions using IE browser.
    When I press TAB key inside of JTextPane the appled looses its focus instead of simply insert an indent as it should be.
    Interesting, that this problem reproduces only under IE (in Firefox it works properly).
    Maybe someone knows how to workaround this problem?
    I'll be very thankfull for answers!
    With best regards,
    Andrew.

    Thanks for all who participated in resolving of my problem. It's eventually has been resolved by myself.
    The solution was very complicated and looks like unskilful workaround, but it was one, which really helped.
    So now I just want to describe it, maybe someone else will faced the similar problem.
    First I added to main class of applet following public method (for manual handling of tab key):
    public void handleTab() throws Exception{
         textPane.grabFocus();
         Document doc = textPane.getDocument();
         doc.insertString(textPane.getCaretPosition(), "\t", null);
         textPane.setCaretPosition(textPane.getCaretPosition() + 1);
    }After that I simply can invoke this method from JScript. So my wrapping page can be like this:
    <HTML>
    <HEAD>
    <BODY>
    <APPLET CODEBASE="." ARCHIVE="editor.jar" CODE="editor.applet.EditorApplet.class" NAME="editor" WIDTH="640" HEIGHT="480" MAYSCRIPT >
    </APPLET>
    <INPUT name="stub1" type=text onfocus="editor.handleTab();" style="position:absolute; top:100; left:100;">
    <INPUT name="stub2" type=text onfocus="stub1.focus();" style="position:absolute; top:150; left:100;">
    </BODY>
    </HTML>I know, this looks little bit strange, so let me clearify some details and aspects of IE behavior.
    - When I press TAB, focus goes to "stub1" input box, which invokes 'editor.handleTab' immediately. But inspite of focus was grabbeg back by applet (invoking textPane.grabFocus()), it is ALSO REMAIS IN BROWSER in inputbox. So when I press TAB again, focus moves not to "stub1" again, but to the next flow control "stub2". So in this case "stub2" must return the focus to "stub1". It is like chain reaction ;-)
    - both input box stubs has an absolute positioning and simply hidden under the applet, so all these manipulations are invisible for end-user of applet and looks like 100%-natural behavior of any editable text area.

  • How to Detect Database Conneciton Lost in Applet

    Hi,
    Is there a way to detect loss of database conneciton or network conneciton in an applet while it is running? We have an applet application and want to perform some database updates based on loss of database or network connectivity while the applet is running.
    Just thinking out loud - is there a way to use some thread that constants runs in the loaded applet code and checks for database or network connectivity.
    Thanks

    That will be a manual process since we will know the list of users who had logged in thru the logs. What we are trying to do is to limit the concurrent connections for the users to the system. So if a conneciton is lost the users current count has to be decremented.
    The select query you mentioned is trivial but how can we make this run all the time in the background. Do we use some thread etc?

  • My iphone 4 has lost its software. itunes keeps saying it wont detect my iphone 4 and the iphone keeps saying connect to itunes. how do i fix this?

    my iphone 4 has lost its software. itunes keeps saying it wont detect my iphone 4 and the iphone keeps saying connect to itunes. how do i fix this?

    Place the device in DFU mode and restore.

  • HT4623 Hi!My iPAD lost its charge fast !!I've got an iPAD capacity 57,1GB and it has available 55,1GB ,version 7.0.4 .I'd like to know how long does the battery last when it is 100 % charged.

    Hi!I've just installed the iOS 7.0.4 operating system and the battery lost its charge at an incredibly speed.I'd like to know how long does the battery last if everything is right when it has 100% charge.Thanks!

    I`m `propping` up this thread to to the top of the forums again as it`s been three months and not a single community member or Apple support personnel have replied, which I find discouraging.
    I`ve tried everything - both the iOS device(s) and Apple TV have been upgraded (albeit reluctantly) to the latest versions, since iOS 7 looks like crap compared to iOS 6. Both use the same WiFi network. Bluetooth is set to `off`, as per the online tutorials on the Apple Support page.
    I also tried shutting all of them down, including the router, waiting 30 seconds and turning the router, then the Apple TV then the iOS device on sequentially with 30 seconds in between each, again as per this discussion forum, and still nothing.
    Why can Apple not make a technology, such as AirPlay, work with greater than 10%?
    Any other ideas?
    Come on, people.
    Thanks,
    Doug

  • I am a cloud member and my cs6 encore lost its library of templates, how to i get them back

    I am a cloud member and my cs6 encore lost its library of templates, how to i get them back

    All Cloud versions of AI (both CC and CS6) are 64bit.

  • First generation apple tv has lost its main menu bar on top of screen.  Also I am currently in language choice and my remote seems to be locked, is that possible and if so how do you unlock it?

    first generation apple tv has lost its main menu bar on top of screen.  Also I am currently in language choice and my remote seems to be locked, is that possible and if so how do you unlock it?

    You would need to go to an Apple Store (make an appointment) and take the phone, her father's original invoice when the phone was purchased, and a copy of his death certificate. Only with these will Apple unlock it. If you can't get these, the phone is permanently unusable.

  • I lost my Iphon how to find it please when its offline please

    I lost my Iphon how to find it please when its offline please if  someone nowwww

    If it's offline, Find my iPhone will not work and the only way to find it is the old fashion way... physically looking for it.  Good luck.

  • How do I migrate from my old mac that lost its display to my new mac?

    How do I migrate from my old iMac that lost its display to my new iMac?

    That can depend on what model iMac is the old one. With some models it's relatively easy to remove the hard drive. once out, you can use a device like this:
    Newer Technology Universal Drive Adapter USB 3.0 - connects any 2.5", 3.5" or 5.25" drive
    to connect the old drive to the new Mac. It will show up exactly as if you had an external hard drive in an enclosure. Them you can access the drive.
    Can you give us an idea of what iMac variant the old one represents? The are four broad families: G3; G5: G5, and Intel. You can usually find the processor information the same tag that has the serial number.
    I believe that, if you enter its serial number in tis Apple web page:
    https://selfsolve.apple.com/agreementWarrantyDynamic.do
    it will give you a description of the computer with the pertinent information.

  • How can I find my lost IPod using its serial number?

    How can I find my lost iPod using its serial number?

    As I said, and Varjak said, if it is setup in iCloud, login to iCloud from your comptuier or other device, click on Find My and find the entry for the iPod, and if it is turned on and connected to the internet it will show up.

  • How can I find my lost ipad-2 with WIFI only. I have only its serial no. icloud says alway the device is offline

    how can I find my lost ipad-2 with WIFI only. I have only its serial no. icloud says alway the
    device is offline

    It will only show if the device is turned on. And if someone else has it, they can turn that feature off. Your best options are to return to the location where you think you lost it, and see if anyone returned it. Also contact your local law enforcement.
    Reporting a lost or stolen product
    http://support.apple.com/kb/HT2526
    Report to police along with serial number. Change all your passwords.
    These links may be helpful.
    How to Track and Report Stolen iPad
    http://www.ipadastic.com/tutorials/how-to-track-and-report-stolen-ipad
    Reporting a lost or stolen Apple product
    http://support.apple.com/kb/ht2526
    Report Stolen iPad Tips and iPad Theft Prevention
    http://www.stolen-property.com/report-stolen-ipad.php
    How to recover a lost or stolen iPad
    http://ipadhelp.com/ipad-help/how-to-recover-a-lost-or-stolen-ipad/
    How to Find a Stolen iPad
    http://www.ehow.com/how_7586429_stolen-ipad.html
    Apple Product Lost or Stolen
    http://sites.google.com/site/appleclubfhs/support/advice-and-articles/lost-or-st olen
    Oops! iForgot My New iPad On the Plane; Now What?
    http://online.wsj.com/article/SB10001424052702303459004577362194012634000.html
    If you don't know your lost/stolen iPad's serial number, use the instructions below. The S/N is also on the iPad's box.
    How to Find Your iPad Serial Number
    http://www.ipadastic.com/tutorials/how-to-find-your-ipad-serial-number

  • TS1630 My iPad has lost its sound. How do I get it back?

    My ipad has lost its sound how can I get it back

    Hi MsVee18,
    If you are having audio issues with your iPad, you may find the following article helpful (it is aimed at the iPhone, but the steps should apply to the iPad as well):
    iPhone: No sound or distorted sound from speaker
    http://support.apple.com/kb/ts5180
    Regards,
    - Brenden

  • My computer has lost its sound and audio? how can i get it ?

    My laptop has lost its sound and audio. I dont know how to fix it. help me please.

    It's not lost. It's never there. FaceTime icon is only present in ipad and ipod touch. You can use FaceTime right of Messages. check this link out : http://iphone-and-i.blogspot.com/2012/01/how-to-activate-facetime-in-iphone-4s.h tml

  • TS1717 2 months ago, my iTunes dj (on my PC) lost its ability to "Shuffle"   (I cannot get shuffle on) as well as its shuffle function.  Anyone out ther know how to fix this?

    2 months ago my iTunes dj (0n my ASUS PC) lost its ability to shuffle.  It will not allow me to turn "shuffle" on, and "refresh" does not work either.

    Just connect the new iPod to your computer and setup the iPod via iTunes (instead of via wifi).
    If you want to copy all the infor from an old iPod touch to the inew iPod see:
    iOS: Transferring information from your current iPhone, iPad, or iPod touch to a new device

  • How to detect the key enter with a numerical control without using loop event?

    I want to accept a numerical value only when the key enter is pressed, but without using the event. How to detect the char "enter" with a numerical control?
    Thanks!

    When the user edits a numeric control with a keyboard, its property "key focus" is true. When the user hits enter, key focus becomes false. Poll the property to latch the control valuse at the true-false transition. That won't work if the user modify the control using up and down arrows.
    LabVIEW, C'est LabVIEW

Maybe you are looking for