This patch makes the tree control icons to look differently and more
similar to Sun's tree control icons (despite they are not pixel to pixel
the same). The color of the tree vertical lines (hash color) is also
corrected, it should not be black. However the gray blue does not look
well in GNU L&F, so I preserved the black value here. Currently there is
something wrong with the background in GNU L&F, but this patch is not
related to that problem.
2006-07-04 Audrius Meskauskas <[EMAIL PROTECTED]>
* gnu/javax/swing/plaf/gnu/GNULookAndFeel.java
(getDefaults): Set hash color to black.
* javax/swing/plaf/basic/BasicLookAndFeel.java
(initComponentDefaults): Set hash color to grey blue.
* javax/swing/plaf/basic/BasicTreeUI.java
(instellDefaults): Set hash color.
* javax/swing/plaf/metal/MetalIconFactory.java
(TreeControlIcon.paint): Rewritten.
Index: gnu/javax/swing/plaf/gnu/GNULookAndFeel.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/javax/swing/plaf/gnu/GNULookAndFeel.java,v
retrieving revision 1.1
diff -u -r1.1 GNULookAndFeel.java
--- gnu/javax/swing/plaf/gnu/GNULookAndFeel.java 16 Mar 2006 12:01:31 -0000 1.1
+++ gnu/javax/swing/plaf/gnu/GNULookAndFeel.java 4 Jul 2006 11:35:19 -0000
@@ -71,6 +71,7 @@
"ScrollBar.background", new ColorUIResource(blueGray),
"CheckBox.icon", new CheckBoxIcon(),
"RadioButton.icon", new RadioButtonIcon(),
+ "Tree.hash", new ColorUIResource(Color.black),
"Tree.closedIcon",
new IconUIResource(new ImageIcon
Index: javax/swing/plaf/basic/BasicLookAndFeel.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java,v
retrieving revision 1.96
diff -u -r1.96 BasicLookAndFeel.java
--- javax/swing/plaf/basic/BasicLookAndFeel.java 15 Jun 2006 14:15:45 -0000 1.96
+++ javax/swing/plaf/basic/BasicLookAndFeel.java 4 Jul 2006 11:35:38 -0000
@@ -1610,7 +1610,7 @@
}),
"Tree.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"Tree.foreground", new ColorUIResource(Color.black),
- "Tree.hash", new ColorUIResource(new Color(128, 128, 128)),
+ "Tree.hash", new ColorUIResource(new Color(184, 207, 228)),
"Tree.leftChildIndent", new Integer(7),
"Tree.rightChildIndent", new Integer(13),
"Tree.rowHeight", new Integer(16),
Index: javax/swing/plaf/basic/BasicTreeUI.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v
retrieving revision 1.147
diff -u -r1.147 BasicTreeUI.java
--- javax/swing/plaf/basic/BasicTreeUI.java 4 Jul 2006 10:07:47 -0000 1.147
+++ javax/swing/plaf/basic/BasicTreeUI.java 4 Jul 2006 11:35:47 -0000
@@ -1240,6 +1240,11 @@
{
LookAndFeel.installColorsAndFont(tree, "Tree.background",
"Tree.foreground", "Tree.font");
+
+ hashColor = UIManager.getColor("Tree.hash");
+ if (hashColor == null)
+ hashColor = Color.black;
+
tree.setOpaque(true);
rightChildIndent = UIManager.getInt("Tree.rightChildIndent");
Index: javax/swing/plaf/metal/MetalIconFactory.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/plaf/metal/MetalIconFactory.java,v
retrieving revision 1.26
diff -u -r1.26 MetalIconFactory.java
--- javax/swing/plaf/metal/MetalIconFactory.java 13 Jun 2006 21:08:10 -0000 1.26
+++ javax/swing/plaf/metal/MetalIconFactory.java 4 Jul 2006 11:35:52 -0000
@@ -1801,78 +1801,36 @@
/**
* Paints the icon at the location (x, y).
*
- * @param c the component.
- * @param g the graphics device.
- * @param x the x coordinate.
- * @param y the y coordinate.
- */
- public void paintIcon(Component c, Graphics g, int x, int y)
- {
- x = x + 5;
- y = y + 5;
- if (collapsed)
- {
- // TODO: pick up appropriate UI colors
- g.setColor(Color.black);
- g.drawLine(x + 2, y, x + 5, y);
- g.drawLine(x + 6, y + 1, x + 7, y + 2);
- g.fillRect(x + 7, y + 3, 5, 2);
- g.drawLine(x + 7, y + 5, x + 6, y + 6);
- g.drawLine(x + 1, y + 1, x + 1, y + 1);
- g.drawLine(x, y + 2, x, y + 5);
- g.drawLine(x + 1, y + 6, x + 1, y + 6);
- g.drawLine(x + 2, y + 7, x + 5, y + 7);
- g.fillRect(x + 3, y + 3, 2, 2);
-
- g.setColor(new Color(204, 204, 255));
- g.drawLine(x + 3, y + 2, x + 4, y + 2);
- g.drawLine(x + 2, y + 3, x + 2, y + 4);
- g.drawLine(x + 3, y + 5, x + 3, y + 5);
- g.drawLine(x + 5, y + 3, x + 5, y + 3);
-
- g.setColor(new Color(153, 153, 204));
- g.drawLine(x + 2, y + 2, x + 2, y + 2);
- g.drawLine(x + 2, y + 5, x + 2, y + 5);
- g.drawLine(x + 2, y + 6, x + 5, y + 6);
- g.drawLine(x + 5, y + 2, x + 5, y + 2);
- g.drawLine(x + 6, y + 2, x + 6, y + 5);
-
- g.setColor(new Color(102, 102, 153));
- g.drawLine(x + 2, y + 1, x + 5, y + 1);
- g.drawLine(x + 1, y + 2, x + 1, y + 5);
- }
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x coordinate.
+ * @param y the y coordinate.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ // TODO: pick up appropriate UI colors
+ Color dark = new Color(99, 130, 191);
+ Color light = new Color(163, 184, 204);
+ Color white = Color.white;
+
+ x += 8;
+ y += 6;
+
+ final int w = 6;
+ final int wHalf = (w >> 2);
+ g.setColor(light);
+ g.drawOval(x, y, w, w);
+ g.setColor(dark);
+ g.fillOval(x + 1, y + 1, w - 1, w - 1);
+
+ if (collapsed)
+ g.fillRect(x + w, y + wHalf + 1, w, 2);
else
- {
- // TODO: pick up appropriate UI colors
- g.setColor(Color.black);
- g.drawLine(x + 2, y, x + 5, y);
- g.drawLine(x + 6, y + 1, x + 7, y + 2);
- g.drawLine(x + 7, y + 2, x + 7, y + 5);
- g.fillRect(x + 3, y + 7, 2, 5);
- g.drawLine(x + 7, y + 5, x + 6, y + 6);
- g.drawLine(x + 1, y + 1, x + 1, y + 1);
- g.drawLine(x, y + 2, x, y + 5);
- g.drawLine(x + 1, y + 6, x + 1, y + 6);
- g.drawLine(x + 2, y + 7, x + 5, y + 7);
- g.fillRect(x + 3, y + 3, 2, 2);
-
- g.setColor(new Color(204, 204, 255));
- g.drawLine(x + 3, y + 2, x + 4, y + 2);
- g.drawLine(x + 2, y + 3, x + 2, y + 4);
- g.drawLine(x + 3, y + 5, x + 3, y + 5);
- g.drawLine(x + 5, y + 3, x + 5, y + 3);
-
- g.setColor(new Color(153, 153, 204));
- g.drawLine(x + 2, y + 2, x + 2, y + 2);
- g.drawLine(x + 2, y + 5, x + 2, y + 5);
- g.drawLine(x + 2, y + 6, x + 5, y + 6);
- g.drawLine(x + 5, y + 2, x + 5, y + 2);
- g.drawLine(x + 6, y + 2, x + 6, y + 5);
-
- g.setColor(new Color(102, 102, 153));
- g.drawLine(x + 2, y + 1, x + 5, y + 1);
- g.drawLine(x + 1, y + 2, x + 1, y + 5);
- }
+ g.fillRect(x + wHalf + 1, y + w, 2, w);
+
+ g.setColor(white);
+ g.fillRect(x + wHalf + 1, y + wHalf + 1, 2, 2);
+
}
/**