[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/23009] swing: ActionEvent.actionCommand=null for JMenuIte
From: |
gcc-bugzilla at gcc dot gnu dot org |
Subject: |
[Bug classpath/23009] swing: ActionEvent.actionCommand=null for JMenuItem |
Date: |
8 Sep 2010 18:04:48 -0000 |
Steps to reproduce:
1. Compile and run the attached testcase.
2. Choose File->Exit
Expected results:
1. A window with File menu shows up.
2. Program prints out "actionPerformed,actionCommand=Exit"
Actual results:
1. A window with File menu shows up.
2. Program prints out "actionPerformed,actionCommand=null"
Testcase:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class testcase extends JFrame implements ActionListener {
public static void main(String[] args) {
new testcase().show();
}
public testcase() {
JMenuItem exit = new JMenuItem("Exit");
exit.addActionListener(this);
JMenu file = new JMenu("File");
file.add(exit);
JMenuBar bar = new JMenuBar();
bar.add(file);
this.setJMenuBar(bar);
this.setSize(new Dimension(400, 400));
}
public void actionPerformed(ActionEvent e) {
System.out.println("actionPerformed,actionCommand="
+ e.getActionCommand());
}
}
------- Comment #1 from from-classpath at savannah dot gnu dot org 2005-07-07
14:52 -------
the bugfix is the following:
add this line to javax.swing.JMenuItem.init(String text, Icon icon)
setActionCommand(text);
------- Comment #2 from from-classpath at savannah dot gnu dot org 2005-07-13
13:08 -------
I have fixed this in CVS and it seems to work for your testcase.
Could you please test if it works as you expected it?
------- Comment #3 from from-classpath at savannah dot gnu dot org 2005-07-14
11:44 -------
Both the testcase and the real application (guihelper.sf.net) seem to work now.
Thanks a lot!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23009
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug classpath/23009] swing: ActionEvent.actionCommand=null for JMenuItem,
gcc-bugzilla at gcc dot gnu dot org <=