Current Position:Home > Applet looses its focus in IE

Applet looses its focus in IE

Update:10-11Source: network consolidation
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,

The Best Answer

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{
     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:
<APPLET CODEBASE="." ARCHIVE="editor.jar" CODE="editor.applet.EditorApplet.class" NAME="editor" WIDTH="640" HEIGHT="480" MAYSCRIPT >
<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;">
</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.
  • Applet looses its focus in IE Update:10-11

    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

  • JTextArea doesn't loose the focus Update:11-30

    Hi everybody, I programmed a graphical interface with two JTextAreas and six JTextFields. Using the program means that I delete the text of both JTextAreas and paste new text. An algorithm calculates the results. After that I insert new text and star

  • Dir11 is loosing keyboard focus! Update:11-30

    I have a kiosk application running WITHOUT a mouse. All inputs is from the keyboard. The app is autostarting when Windows starts. After playing a Flash animation and a mpeg2 video (Mpeg adv xtra) the application looses keyboard focus, wich result in

  • How to detect if applet lost its focus Update:11-30

    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 java

  • Adobe CC Updated disappears, if it loose the focus! Update:11-30

    Hi! I updated the Adobe CC Updater, but I've still this issue: If the Adobe Updater loose the focus, it disappears. Then I've to open it again via the Systray. That is a little bit annoying, especially if you want just to use your password manager to

  • Loosing & gaining focus of a window. Update:11-30

    In my GUI, I have created a window, that is having 2 buttons named "Enabled" & "Disabled". MY requirement is: After execution of the window when I will click "Disable" button, the window should loose its focus and then cl

  • Swing Applet - Internet Explorer - Focus issue - tool tips Update:11-30

    Hi , We are using Swing applet in IE Browser , except this swing component rest of the components in the browser are HTML/DHTML components. and we are having issue focus issue with this swing components , once immediately after launching the swing ap

  • Loosing Application Focus Update:11-30

    My Imac keeps loosing focus of the window I'm operating out of. Examples: During a skype video call the display window will go "out of focus" and leave me with the mini viewer. I only know this to happen when an application is in use over skype.

  • Window with applet tag gains focus prior to new window browser window Update:11-30

    setup a : 1. sample index.html page: <HTML> <HEAD> <script> var _load=function(){'test.html');}; window.attachEvent("onload", _load); </script> </HEAD> <BODY> <applet code=Index name=Index width

  • Acrobat looses windows focus after showing a wxWidgets modal dialog Update:11-30

    Here's a code sample:      AVWindow dlgWindow = AVWindowNewFromPlatformThing(AVWLmodal, NULL, NULL, gExtensionID, dlg->GetHWND());     AVAppBeginModal(dlgWindow);     dlg->ShowModal();                                   // dlg is a wxDialog*     AVWi