Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4396447

Focus problem leaves applet unusable

XMLWordPrintable

    • 02
    • sparc
    • solaris_8


        The following problem occurs with Netscape 4.7 Using the Java Plug-in v1.3.0 and v1.3.0_01 on Solaris 8.

        The customers application runs as an Applet using JPI v1.3.x. They found that after opening a child window, Focus would be returned to the browser and not to the applet. To overcome this they have written thaeir code such that after opening and closing a child window the component that should have the focus once again requests the focus by sending requestFocus() to the parent Frame.

        When running the as a Java application there is no problem on either Solaris or Win32, there is also no problem with Netscape 4.76 and IE 5.5 on Windows.

        Running as an applet under Motif with Netscape 4.7 & 4.76 when you return from the child window you can be left in a state where the applet will not recognise the focus. No amount of clicking with the mouse will make it operable again. The only way to do that is to re-size the browser window horizontally, which magically restores things.

        The supplied test case is a cut down version of the customers applet. The view
        consists of a text field and a split pane. Each pane contains a tabbed pane.
        Each tabbed pane contains a panel, and each panel contains a tree. Swing
        components or specialisations of Swing components are used throughout. For
        aesthetic reasons they have implemented our own TreeCellRenderer.

        For debugging purposes, the text field at the top of the example applet
        indicates focus events being listened for. It will show when the left or
        right tree has focus. When the selection on the left tree changes, the right
        tree is re-loaded, to mimic the normal behaviour of the customers applet.

        The tree nodes have a context menu from which a Dialog can be opened. The problem occurs when the dialog is opened and closed although it is intermittant.

        Steps to recreation:
        a) Un-jar the test case and point Netscape to where you extracted the files.
        b) Open the file FocusExample.html in the browser.

        1. Close all 4 branch nodes.

        2. left click 'Right 2' so that it highlights
        3. right click 'Right 2' and select open dialog
        4. close dialog

        5. repeat from 2 until left click on 'Right 2' doesn't highlight it

        6. Left click on 'Left 1' so that it highlights.
        7. Right click on 'Right 2' and select open dialog
        8. close dialog, 'Right 2' is still highlighted
        9. left click 'Left 2', both 'Right 2' and 'Left 2' are selected.

        10. resize window horizontally and start again.

        Some println's have been added to the test case to help identify what's happening where. The child window class LazyPropertySheet extends LazyEscDlg and when you instantiate LazyPropertySheet, the super constructor is called passing the parent frame as an argument. When the child window is closed the super class's dispose() method is called and focus is returned to the parent frame using parent.requestFocus().

        ###@###.### 2001-08-29

        Merlin builds have the same problem.

        Netscape 4.76,
        java version "1.4.0-beta3"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b78)
        Java HotSpot(TM) Client VM (build 1.4.0-beta3-b78, mixed mode)

        To see the problem, use a Java 2 applet from Sun's web pages.
        http://java.sun.com/docs/books/tutorial/uiswing/events/KeyEventDemo.html

        The suggested work around does not work around the problem.

              tmasunw Tao Ma (Inactive)
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: