[kaffe] Action command fixes for java.awt.Button

S. Meslin-Weber steph at tangency.co.uk
Tue Sep 21 14:28:25 PDT 2004


Hi everyone,

I got persuaded to try MegaMek[1] with Odonata[2] and although I haven't
got that combination quite working, here are two small patches (one for
classpath, the other for kaffe) to fix a small issue with the handling
of the ActionCommand property of java.awt.Button

In a nutshell, this property shouldn't be set to the Button's label,
null is (as far as I can tell) a valid value.

Thanks,

Stephane

[1] http://megamek.sf.net
[2] http://odonata.tangency.co.uk

-- 
================================================================
Stephane Meslin-Weber         Email: steph at tangency.co.uk
Software Engineer             Web: http://odonata.tangency.co.uk
================================================================
-------------- next part --------------
Index: Button.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Button.java,v
retrieving revision 1.14
diff -u -r1.14 Button.java
--- Button.java	8 Aug 2004 20:11:39 -0000	1.14
+++ Button.java	21 Sep 2004 21:26:07 -0000
@@ -119,7 +119,6 @@
 Button(String label)
 {
   this.label = label;
-  actionCommand = label;
 
   if (GraphicsEnvironment.isHeadless ())
     throw new HeadlessException ();
@@ -153,7 +152,7 @@
 setLabel(String label)
 {
   this.label = label;
-  actionCommand = label;
+
   if (peer != null)
     {
       ButtonPeer bp = (ButtonPeer) peer;
@@ -184,7 +183,7 @@
 public void
 setActionCommand(String actionCommand)
 {
-  this.actionCommand = actionCommand == null ? label : actionCommand;
+  this.actionCommand = actionCommand;
 }
 
 /*************************************************************************/
-------------- next part --------------
Index: Button.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/awt/Button.java,v
retrieving revision 1.4
diff -u -r1.4 Button.java
--- Button.java	9 Aug 2004 13:44:17 -0000	1.4
+++ Button.java	21 Sep 2004 21:03:24 -0000
@@ -119,7 +119,6 @@
 Button(String label)
 {
   this.label = label;
-  actionCommand = label;
 
   if (GraphicsEnvironment.isHeadless ())
     throw new HeadlessException ();
@@ -153,7 +152,7 @@
 setLabel(String label)
 {
   this.label = label;
-  actionCommand = label;
+
   if (peer != null)
     {
       ButtonPeer bp = (ButtonPeer) peer;
@@ -184,7 +183,7 @@
 public void
 setActionCommand(String actionCommand)
 {
-  this.actionCommand = actionCommand == null ? label : actionCommand;
+  this.actionCommand = actionCommand;
 }
 
 /*************************************************************************/


More information about the kaffe mailing list