I committed this patch to add a new icon to MetalIconFactory:
2005-09-10 David Gilbert <[EMAIL PROTECTED]> * javax/swing/plaf/metal/MetalIconFactory.java (PaletteCloseIcon): new class. Regards, Dave Gilbert
Index: javax/swing/plaf/metal/MetalIconFactory.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalIconFactory.java,v retrieving revision 1.11 diff -u -r1.11 MetalIconFactory.java --- javax/swing/plaf/metal/MetalIconFactory.java 8 Sep 2005 14:57:06 -0000 1.11 +++ javax/swing/plaf/metal/MetalIconFactory.java 10 Sep 2005 21:01:10 -0000 @@ -43,6 +43,7 @@ import java.awt.Graphics; import java.io.Serializable; +import javax.swing.AbstractButton; import javax.swing.Icon; import javax.swing.JCheckBox; import javax.swing.JCheckBoxMenuItem; @@ -662,7 +663,68 @@ } } - + + /** + * An icon used by the [EMAIL PROTECTED] MetalInternalFrameUI} class when the frame + * is displayed as a palette. + * + * @since 1.3 + */ + public static class PaletteCloseIcon implements Icon, Serializable + { + /** + * Returns the width of the icon, in pixels. + * + * @return The width of the icon. + */ + public int getIconWidth() + { + return 7; + } + + /** + * Returns the height of the icon, in pixels. + * + * @return The height of the icon. + */ + public int getIconHeight() + { + return 7; + } + + /** + * Paints the icon using colors from the [EMAIL PROTECTED] MetalLookAndFeel}. + * + * @param c the component (ignored). + * @param g the graphics device. + * @param x the x-coordinate for the top-left of the icon. + * @param y the y-coordinate for the top-left of the icon. + */ + public void paintIcon(Component c, Graphics g, int x, int y) + { + Color savedColor = g.getColor(); + AbstractButton button = (AbstractButton) c; + if (button.getModel().isPressed()) + g.setColor(MetalLookAndFeel.getBlack()); + else + g.setColor(MetalLookAndFeel.getControlDarkShadow()); + g.fillRect(x + 2, y + 2, 3, 3); + g.drawLine(x + 1, y, x + 1, y + 2); + g.drawLine(x, y + 1, x + 2, y + 1); + g.drawLine(x + 5, y, x + 5, y + 2); + g.drawLine(x + 4, y + 1, x + 6, y + 1); + g.drawLine(x + 1, y + 4, x + 1, y + 6); + g.drawLine(x, y + 5, x + 2, y + 5); + g.drawLine(x + 5, y + 4, x + 5, y + 6); + g.drawLine(x + 4, y + 5, x + 6, y + 5); + g.setColor(MetalLookAndFeel.getControlHighlight()); + g.drawLine(x + 2, y + 6, x + 3, y + 5); + g.drawLine(x + 5, y + 3, x + 6, y + 2); + g.drawLine(x + 6, y + 6, x + 6, y + 6); + g.setColor(savedColor); + } + } + /** * An [EMAIL PROTECTED] Icon} implementation for [EMAIL PROTECTED] JCheckBox}es in the * Metal Look & Feel.
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches