[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: MetalBorders.PaletteBorder
From: |
David Gilbert |
Subject: |
[cp-patches] FYI: MetalBorders.PaletteBorder |
Date: |
Sat, 10 Sep 2005 23:06:30 +0000 |
User-agent: |
Mozilla Thunderbird 1.0.6 (X11/20050728) |
I committed this patch:
2005-09-10 David Gilbert <address@hidden>
* javax/swing/plaf/metal/MetalBorders.java
(PaletteBorder): new class.
Regards,
Dave Gilbert
Index: javax/swing/plaf/metal/MetalBorders.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalBorders.java,v
retrieving revision 1.11
diff -u -r1.11 MetalBorders.java
--- javax/swing/plaf/metal/MetalBorders.java 31 Aug 2005 16:52:42 -0000
1.11
+++ javax/swing/plaf/metal/MetalBorders.java 10 Sep 2005 21:46:46 -0000
@@ -262,6 +262,88 @@
}
/**
+ * A border used for a address@hidden JInternalFrame} when it is being used
as a
+ * palette.
+ *
+ * @since 1.3
+ */
+ public static class PaletteBorder
+ extends AbstractBorder
+ implements UIResource
+ {
+ /**
+ * Creates a new <code>PaletteBorder</code>.
+ */
+ public PaletteBorder()
+ {
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, null);
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ * @param newInsets the insets object that, if non-<code>null</code>,
will
+ * be populated with the result from this method.
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c, Insets newInsets)
+ {
+ if (newInsets == null)
+ newInsets = new Insets(1, 1, 1, 1);
+ else
+ {
+ newInsets.top = 1;
+ newInsets.left = 1;
+ newInsets.bottom = 1;
+ newInsets.right = 1;
+ }
+ return newInsets;
+ }
+
+ /**
+ * Paints the border for the specified component.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ Color savedColor = g.getColor();
+
+ // draw the outline
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ g.drawRect(x, y, w - 1, h - 1);
+
+ // put a dot in each corner
+ g.setColor(MetalLookAndFeel.getControl());
+ g.fillRect(x, y, 1, 1);
+ g.fillRect(x + w - 1, y, 1, 1);
+ g.fillRect(x + w - 1, y + h - 1, 1, 1);
+ g.fillRect(x, y + h - 1, 1, 1);
+ g.setColor(savedColor);
+ }
+
+ }
+
+ /**
* A border used for the address@hidden JTextField} component.
*/
public static class TextFieldBorder extends Flush3DBorder
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: MetalBorders.PaletteBorder,
David Gilbert <=