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

[UNIX/Linux] Focus is lost from AWT Button when pressing HOME key

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.4.2
    • client-libs

      Name: dk106046 Date: 07/13/2004

      OPERATING SYSTEM(S):
      RedHat Enterprise Linux 3
      Solaris 9 for x86

      FULL JDK VERSION(S):
      Linux:
      java version "1.4.2_04"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
      Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)

      Solaris 9:
      java version "1.4.2_04"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
      Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)


      Focus is lost without focusLost event when Home key is pressed.
      Also Input Method Framework does not work correctly after this operation.

      Test instruction is as follows:
      1. Compile and run following test program (ButtonTest.java)
      2. Press Space key, then button may be pressed
         (If not, please move focus to Button component)
      3. Press Home key. Focus is lost without focusLost event. <== PROBLEM
      4. Press Tab or Shift+Tab to move focus, but focus is still lost <== PROBLEM
      5. Move focus to another window, focusLost event is received.

      If you have Japanese enviroment, please try following instruction:
      Linux:
      1. Compile and run following test program (ButtonTest.java) with Japanese environment
         (I assume you are using kinput2+canna)
      2. Press Shift+Space to activate root IM for kinput2.
      3. Press Shift+Space to deactivate root IM
      4. Press Home key
      5. Press Shift+Space to activate root IM, but Java IM may be activated <== PROBLEM
      6. Press "a", Java Input Window is displayed.
         (At this time, focus is backed to Button component)

      Solaris9:
      1. Compile and run following test program (ButtonTest.java) with Japanese environment
      2. Press Ctrl+Space to activate root IM.
      3. Press "aiueo", root IM window is displayed
      3. Press Ctrl+Space to deactivate root IM
      4. Press Home key
      5. Press Ctrl+Space to activate root IM, but Java IM may be activated <== PROBLEM
         Press "a", Java Input Window is displayed.
         (At this time, focus is backed to Button component)

      ==========================================
      import java.awt.*;
      import java.awt.event.*;

      class ButtonTest extends Frame implements KeyListener, FocusListener {
          ButtonTest () {
              setLayout(new FlowLayout());
              Button button = new Button("Button");
              button.addKeyListener(this);
              button.addFocusListener(this);
              add(button);
      addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) { System.exit(0); }
              });
              pack();
              show();
          }
          public void keyPressed (KeyEvent e) {
              System.out.println("keyPressed called");
          }
          public void keyTyped (KeyEvent e) {
              System.out.println("keyTyped called");
          }
          public void keyReleased (KeyEvent e) {
              System.out.println("keyReleased called");
          }
          public void focusGained (FocusEvent e) {
              System.out.println("focusGained called");
          }
          public void focusLost (FocusEvent e) {
              System.out.println("focusLost called");
          }
          public static void main (String[] args) {
              ButtonTest f = new ButtonTest ();
          }
      }
      ==========================================

      ======================================================================
      ###@###.### 10/24/04 22:36 GMT

            yyamasaksunw Yuriko Yamasaki (Inactive)
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: