summaryrefslogtreecommitdiff
path: root/javax/swing/plaf/metal/MetalBorders.java
diff options
context:
space:
mode:
authorDavid Gilbert <david.gilbert@object-refinery.com>2005-09-10 21:52:23 +0000
committerDavid Gilbert <david.gilbert@object-refinery.com>2005-09-10 21:52:23 +0000
commitcc1839a19b312b428bde1fdb22f4d84f92baba18 (patch)
tree720ddd284d218d3f12d5cd738fc88c4b003a81d5 /javax/swing/plaf/metal/MetalBorders.java
parentb330a6bd1df70b23ce0fc2d74fc964f2cefd22a7 (diff)
downloadclasspath-cc1839a19b312b428bde1fdb22f4d84f92baba18.tar.gz
2005-09-10 David Gilbert <david.gilbert@object-refinery.com>
* javax/swing/plaf/metal/MetalBorders.java (PaletteBorder): new class.
Diffstat (limited to 'javax/swing/plaf/metal/MetalBorders.java')
-rw-r--r--javax/swing/plaf/metal/MetalBorders.java82
1 files changed, 82 insertions, 0 deletions
diff --git a/javax/swing/plaf/metal/MetalBorders.java b/javax/swing/plaf/metal/MetalBorders.java
index f55510684..974facf59 100644
--- a/javax/swing/plaf/metal/MetalBorders.java
+++ b/javax/swing/plaf/metal/MetalBorders.java
@@ -262,6 +262,88 @@ public class MetalBorders
}
/**
+ * A border used for a {@link 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 {@link JTextField} component.
*/
public static class TextFieldBorder extends Flush3DBorder