|
Quick Lists
|
|
Bug ID:
|
4659800
|
|
Votes
|
0
|
|
Synopsis
|
REGRESSION: Hitting enter on focused JButton no longer causes action.
|
|
Category
|
java:classes_swing
|
|
Reported Against
|
1.4
|
|
Release Fixed
|
1.4.1(hopper)
|
|
State
|
10-Fix Delivered,
Verified,
bug
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
|
|
Submit Date
|
28-MAR-2002
|
|
Description
|
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)
======================================================================
|
|
Work Around
|
N/A
|
|
Evaluation
|
Reassigning to swing for their evaluation.
xxxxx@xxxxx 2002-03-29
With the Windows look and feel, the default button should follow the focus. It is the default button that is activated by an ENTER press. The problem is that this default-follows-focus only works right now if an initial default button is set with setDefaultButton() on JRootPane. I have now fixed it to work properly even when a default is not explicitly set.
xxxxx@xxxxx 2002-04-02
|
|
Comments
|
Submitted On 06-NOV-2003
adwarner
Does this fix also mean that when the focus goes to a
JRadioButton or a JCheckBox the default focus follows and is
removed from the previous component if that previous
component is a JButton?
I am seeing this in my application running under 1.4.1_03 and
it isn't standard windows behaviour. Checkboxes and radio
buttons aren't treated like buttons in windows for this
purpose.
Cheers,
Andrew.
Submitted On 31-OCT-2005
wpony76
This appears to be occurring in JDK 1.4.2. I have to add a key listener to the buttons in order for focus to accept an ENTER button press.
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |