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.
This commit is contained in:
Bill Kuker 2012-07-01 14:54:25 +00:00 committed by U-WINDOWS-C28163E\Administrator
parent 5531e2c3ca
commit 6e0379fbaf

View File

@ -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());
}
}