-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.0
-
sparc
-
solaris_2.6
A JButton is created with the text "Run". I'm expecting the ActionEvent.getActionCommand() to return this text. Instead it is returning null :
java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=null] on com.sun.java.swing.JButton[,7,7,66x58,layout=com.sun.java.swing.OverlayLayout]
To reproduce run the Java2D demo at :
/usr/local/java/jdk1.2fcs/solaris/demo/jfc/Java2D
Select the Options menu and the Run Window menuitem. And then select the Run button. Nothing happens because e.getActionCommand() returns null.
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand() == "Run") {
runB.setText("Stop");
runB.setBackground(Color.red);
start();
} else if (e.getActionCommand() == "Stop") {
stop();
}
}
java full version "JDK-1.2fcs-B"
java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=null] on com.sun.java.swing.JButton[,7,7,66x58,layout=com.sun.java.swing.OverlayLayout]
To reproduce run the Java2D demo at :
/usr/local/java/jdk1.2fcs/solaris/demo/jfc/Java2D
Select the Options menu and the Run Window menuitem. And then select the Run button. Nothing happens because e.getActionCommand() returns null.
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand() == "Run") {
runB.setText("Stop");
runB.setBackground(Color.red);
start();
} else if (e.getActionCommand() == "Stop") {
stop();
}
}
java full version "JDK-1.2fcs-B"
- duplicates
-
JDK-4156026 Action Command defaults are not working
-
- Closed
-