-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.3.0
-
x86
-
windows_nt
Name: jk109818 Date: 07/20/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)
If we will run the following program, click on button, then click on list row
and press 'Enter' the button will be pressed ! (Only if WindowsLookAndFeel is
set.)
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class ListAndButton extends JFrame {
static {
try {
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception exc) { System.err.println("Error loading L&F: " + exc); }
}
public ListAndButton()
{
Container cp = getContentPane();
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) { System.exit(0); }
});
setSize(400, 300);
JList list = new JList(new String[] { "1", "2", "3" });
list.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e)
{
if (e.getKeyCode()==KeyEvent.VK_ENTER) pr("List : Enter");
}
});
cp.add(list);
JButton but = new JButton();
but.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { pr("Button :
actionPerformed"); }
});
cp.add(but, BorderLayout.EAST);
}
private static void pr (String s) { System.out.println(s); }
public static void main(String[] args)
{
new ListAndButton().setVisible(true);
}
}
(Review ID: 107412)
======================================================================
- duplicates
-
JDK-4388686 REGRESSION: Windows LNF only: JButton fires an action event
-
- Resolved
-