Hi, in order to call the isChecked() method it is not needed to cast a component to a JCheckBox - an AbstractButton is enough. I dont think this costs us anything and makes the class more flexible for all the possible misuses out there. :)
ChangeLog:
2006-09-01 Robert Schuster <[EMAIL PROTECTED]>
* javax/swing/plaf/metal/MetalCheckBoxIcon.java:
(paintIcon): Removed unused import statements, lowered cast requirement
from JCheckBox to AbstractButton.
cya
Robert
Index: javax/swing/plaf/metal/MetalCheckBoxIcon.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java,v
retrieving revision 1.6
diff -u -r1.6 MetalCheckBoxIcon.java
--- javax/swing/plaf/metal/MetalCheckBoxIcon.java 16 Nov 2005 15:43:34 -0000 1.6
+++ javax/swing/plaf/metal/MetalCheckBoxIcon.java 1 Sep 2006 18:09:25 -0000
@@ -1,5 +1,5 @@
/* MetalCheckBoxIcon.java -- An icon for JCheckBoxes in the Metal L&F
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,8 +42,8 @@
import java.awt.Graphics;
import java.io.Serializable;
+import javax.swing.AbstractButton;
import javax.swing.Icon;
-import javax.swing.JCheckBox;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.plaf.UIResource;
@@ -134,8 +134,9 @@
MetalUtils.paintGradient(g, x, y, getIconWidth(), getIconHeight(),
SwingConstants.VERTICAL, "CheckBox.gradient");
border.paintBorder(c, g, x, y, getIconWidth(), getIconHeight());
- JCheckBox cb = (JCheckBox) c;
- if (cb.isSelected())
- drawCheck(c, g, x, y);
+
+ AbstractButton b = (AbstractButton) c;
+ if (b.isSelected())
+ drawCheck(b, g, x, y);
}
}
signature.asc
Description: OpenPGP digital signature
