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

requestFocus() on a frame does not work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 1.1.2
    • client-libs
    • None
    • sparc
    • solaris_2.5

      Calling requestFocus() on a Frame after all the components have been added to
      it and the frame is visible does not give the frame the focus. HJ browser uses
      EditorFrame which is an extension of Frame. At the end of initFrame(), we do
      a requestFocus(). When we check for FocusOwner via the getFocusOwner() call,
      we get back null. This implies that keyEvents are not propogated to the frame
      correctly. I also tried to use windowActivated() from the WindowEvent
      as well as componentShowing() of the ComponentEvent to use as entry
      points for requestFocus, with no success.

      I notice that a piece of code in Window.java is commented out for handling the WindowEvent.ACTIVATED. There is some mention of this messing up focus
      on solaris.
      As a workaround in our HJ code, I now force the textfield to have focus. The
      EditorFrame needs to have focus assigned to it as users might use action keys as soon as the frame comes up (eg: PAGEUP, PAGEDOWN ...)

            Unassigned Unassigned
            mminasan Malini Minasandram
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: