-
Bug
-
Resolution: Fixed
-
P2
-
1.3.0
-
beta
-
generic, x86
-
generic, windows_nt
Name: rmT116609 Date: 11/13/2000
java version "1.3.0rc3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc3-Z)
Java HotSpot(TM) Client VM (build 1.3.0rc3-Z, mixed mode)
In the following program, if focus is set in the text field, and the enter key
is clicked, then the button will fires an action event. This did not
happen in metal LNF and I didn't test motif. This might be similar to bug
4302322 but am not sure.
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
{
public ButtonTest()
{
try
{
UIManager.setLookAndFeel(new
com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
}
catch(Exception e){}
JButton butt = new JButton("butt");
JTextField field = new JTextField("");
this.getContentPane().add(butt,BorderLayout.NORTH);
this.getContentPane().add(field,BorderLayout.CENTER);
butt.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.err.println("button clicked");
}
});
setSize(400,400);
setLocation(100,100);
setVisible(true);
}
public static void main(String[] args)
{
ButtonTest inputTest1 = new ButtonTest();
}
}
(Review ID: 112107)
======================================================================
- duplicates
-
JDK-4354929 Unfocused JButton receives ActionEvent
-
- Closed
-