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

focus events for Lightweights in Windows are not generated with requestFocus

    XMLWordPrintable

Details

    • beta
    • x86, sparc
    • solaris_2.6, windows_nt

    Description

      Focus events do not seem to be generated for Lightweight Components inside a Window. I have attached a test case. It creates a Window with two subclasses of Component. The components override processMouseEvent to request focus on a mouse press. They also override processFocusEvent to track if they have focus. If the component has focus it will draw itself red. There is also debugging code to print out when a component requests focus, and when a focus event is received. If you bring up the application and click on the components you will see that almost all the time focus events are not generated, and that requestFocus fails.
      If you change the code to instead add the components to a Frame, the application works as expected.
      I get this behavior on both solaris and win NT.

      Name: rlT66838 Date: 06/14/2000


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      In a login window (extends JWindow) I have a JTextField, a JPasswordField and
      two JButtons. Both Textfields don't show the cursur if you click in them, they
      also don't show selected text and the key events (typing, backspace) are also
      not in the same "active" field. I don't use any overwritten classes or other
      overwritten methods - just pure plain simple Swing classes.

      Changing just one single word (extends JWindow => extends JFrame) to use a
      frame instead of a window, the textfields behave correctly (cursur is visible,
      text selection is visible). This bug is still in 1.3 ...
      (Review ID: 106070)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              dmendenhsunw David Mendenhall (Inactive)
              svioletsunw Scott Violet (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: