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

REGRESSION: Hitting enter on focused JButton no longer causes action.

    XMLWordPrintable

Details

    • hopper
    • x86
    • windows_2000
    • Verified

    Description



      Name: gm110360 Date: 03/28/2002


      FULL PRODUCT VERSION :
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

      FULL OPERATING SYSTEM VERSION :

      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      When using Windows LookAndFeel, a button that has focus
      used to (in 1.3.1) fire an action event when the <ENTER>
      key was pressed. It no longer does this. I cannot find any
      documentation stating that this has changed.

      REGRESSION. Last worked in version 1.3.1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.run program in 1.4
      2.hit <ENTER> key
      3.Notice that there is no System.out
      4.Run program in 1.3 and repeat. Notice that there is a
      System.out

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expect the Button to be depressed and an action event to
      occur when it has focus and <ENTER> is pressed. This no
      longer happens.

      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import javax.swing.text.*;
      import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
      import java.awt.*;
      import java.awt.event.*;

      public class ButtonTest extends JFrame
      {
      JButton butt1;

          public ButtonTest()
          {
              try
              {
                  UIManager.setLookAndFeel(new
      com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
              }
              catch(Exception e){}
              
              JPanel panel = new JPanel();
              panel.setLayout(new FlowLayout());
      butt1 = new JButton("butt1");
      butt1.addActionListener(new ActionListener()
      {
      public void actionPerformed(ActionEvent e)
      {
      System.err.println("button pushed");
      }
      });

              panel.add(butt1);
      panel.add(new JButton("butt2"));
              getContentPane().add(panel);
              setLocation(100,100);
              setSize(250,250);
              setVisible(true);
              butt1.requestFocus();
          }

          public static void main(String[] args)
          {
              ButtonTest inputTest1 = new ButtonTest();
          }
          
      }

      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      Could add a key listener to self and fire event when enter
      pushed.

      Release Regression From : 1.3.1_02
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Review ID: 144742)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              shickeysunw Shannon Hickey (Inactive)
              gmanwanisunw Girish Manwani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: