classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: swing Button fixlet


From: Roman Kennke
Subject: [cp-patches] FYI: swing Button fixlet
Date: Wed, 25 May 2005 12:56:11 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204

Hi,

according to a Mauve testcase that I will checkin soon the class AbstractButton should not create a ButtonModel on its own, but instead rely on subclasses to create their ButtonModel. The attached patch fixes this.

2005-05-25  Roman Kennke  <address@hidden>

       * javax/swing/AbstractButton.java:
       (constructor): Removed model creation.
       * javax/swing/JButton.java:
       (constructor): Added model creation.
       * javax/swing/JMenuItem.java:
       (init): Added model creation.


/Roman

Index: javax/swing/AbstractButton.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/AbstractButton.java,v
retrieving revision 1.29
diff -u -r1.29 AbstractButton.java
--- javax/swing/AbstractButton.java     18 May 2005 15:19:10 -0000      1.29
+++ javax/swing/AbstractButton.java     25 May 2005 10:52:54 -0000
@@ -523,15 +523,10 @@
  {
     this.text = text;
     default_icon = icon;
-    model = new DefaultButtonModel();
     actionListener = createActionListener();
     changeListener = createChangeListener();
     itemListener = createItemListener();
 
-    model.addActionListener(actionListener);
-    model.addChangeListener(changeListener);
-    model.addItemListener(itemListener);
-
     horizontalAlignment = CENTER;
     horizontalTextPosition = TRAILING;
     verticalAlignment = CENTER;
Index: javax/swing/JButton.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JButton.java,v
retrieving revision 1.11
diff -u -r1.11 JButton.java
--- javax/swing/JButton.java    30 Jul 2004 20:21:19 -0000      1.11
+++ javax/swing/JButton.java    25 May 2005 10:52:54 -0000
@@ -78,6 +78,7 @@
   public JButton(String text, Icon icon)
   {
     super(text, icon);
+    setModel(new DefaultButtonModel());
   }
 
   public Object[] getSelectedObjects()
Index: javax/swing/JMenuItem.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JMenuItem.java,v
retrieving revision 1.15
diff -u -r1.15 JMenuItem.java
--- javax/swing/JMenuItem.java  28 Jan 2005 12:12:54 -0000      1.15
+++ javax/swing/JMenuItem.java  25 May 2005 10:52:54 -0000
@@ -163,6 +163,7 @@
   protected void init(String text, Icon icon)
   {
     super.init(text, icon);
+    setModel(new DefaultButtonModel());
 
     // Initializes properties for this menu item, that are different
     // from Abstract button properties. 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]