From 6e0379fbaff98d8ccce9fa703bc3df1d38776175 Mon Sep 17 00:00:00 2001 From: Bill Kuker Date: Sun, 1 Jul 2012 14:54:25 +0000 Subject: [PATCH] Fixed what I consider a bug: Rendering as a 3D rect uses the actual color selected as the highlighted side of the border, and the main field of the ColorIcon is a darker version of the selected color. Added an OpenRocket Color constructor. --- core/src/net/sf/openrocket/gui/components/ColorIcon.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/gui/components/ColorIcon.java b/core/src/net/sf/openrocket/gui/components/ColorIcon.java index 747a42685..eb68ea168 100644 --- a/core/src/net/sf/openrocket/gui/components/ColorIcon.java +++ b/core/src/net/sf/openrocket/gui/components/ColorIcon.java @@ -4,6 +4,8 @@ import java.awt.Color; import javax.swing.Icon; +import net.sf.openrocket.gui.util.ColorConversion; + /** * An Icon that displays a specific color, suitable for drawing into a button. * @@ -16,6 +18,10 @@ public class ColorIcon implements Icon { this.color = c; } + public ColorIcon(net.sf.openrocket.util.Color c){ + this.color = ColorConversion.toAwtColor(c); + } + @Override public int getIconHeight() { return 15; @@ -29,7 +35,7 @@ public class ColorIcon implements Icon { @Override public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y) { g.setColor(color); - g.fill3DRect(x, y, getIconWidth(), getIconHeight(), false); + g.fillRect(x, y, getIconWidth(), getIconHeight()); } }