This patch (committed) fixes a bug in the setRolloverIcon() and setSelectedRolloverIcon() methods of the AbstractButton class. Some Mauve tests show that, as well as setting the icons, these methods should set the 'rolloverEnabled' property to true.

2006-07-07  David Gilbert  <[EMAIL PROTECTED]>

        * javax/swing/AbstractButton.java
        (setRolloverIcon): Call setRolloverEnabled(true),
        (setRolloverSelectedIcon): Likewise.

Regards,

Dave
Index: javax/swing/AbstractButton.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/AbstractButton.java,v
retrieving revision 1.61
diff -u -r1.61 AbstractButton.java
--- javax/swing/AbstractButton.java     21 Jun 2006 12:29:43 -0000      1.61
+++ javax/swing/AbstractButton.java     7 Jul 2006 15:30:37 -0000
@@ -2092,7 +2092,8 @@
   }
 
   /**
-   * Set the button's rollover icon. The look and feel class should
+   * Set the button's rollover icon and sets the <code>rolloverEnabled</code>
+   * property to <code>true</code>. The look and feel class should
    * paint this icon when the "rolloverEnabled" property of the button is
    * <code>true</code> and the mouse rolls over the button.
    *
@@ -2106,6 +2107,7 @@
     Icon old = rolloverIcon;
     rolloverIcon = r;
     firePropertyChange(ROLLOVER_ICON_CHANGED_PROPERTY, old, rolloverIcon);
+    setRolloverEnabled(true);
     revalidate();
     repaint();
   }
@@ -2124,12 +2126,13 @@
   }
 
   /**
-   * Set the button's rollover selected icon. The look and feel class
-   * should paint this icon when the "rolloverEnabled" property of the button
-   * is <code>true</code>, the "selected" property of the button's model is
-   * <code>true</code>, and the mouse rolls over the button.
+   * Set the button's rollover selected icon and sets the 
+   * <code>rolloverEnabled</code> property to <code>true</code>. The look and 
+   * feel class should paint this icon when the "rolloverEnabled" property of 
+   * the button is <code>true</code>, the "selected" property of the button's 
+   * model is <code>true</code>, and the mouse rolls over the button.
    *
-   * @param r The new rollover selected icon
+   * @param r The new rollover selected icon.
    */
   public void setRolloverSelectedIcon(Icon r)
   {
@@ -2139,6 +2142,7 @@
     Icon old = rolloverSelectedIcon;
     rolloverSelectedIcon = r;
     firePropertyChange(ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, old, r);
+    setRolloverEnabled(true);
     revalidate();
     repaint();
   }

Reply via email to