integrated change described in this thread to the ColorRGBAPropertyEditor
http://hub.jmonkeyengine.org/t/colorrgbapropertyeditor-a-little-improvement/31552
This commit is contained in:
parent
4cb007f3b3
commit
ac7d8d0674
@ -53,6 +53,7 @@ public class ColorRGBADialog extends javax.swing.JDialog {
|
|||||||
super(parent, modal);
|
super(parent, modal);
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
initComponents();
|
initComponents();
|
||||||
|
jColorChooser1.setColor(new Color(((ColorRGBA)editor.getValue()).asIntARGB()));
|
||||||
alphaSlider.setValue(Math.round(((ColorRGBA)editor.getValue()).getAlpha()*100));
|
alphaSlider.setValue(Math.round(((ColorRGBA)editor.getValue()).getAlpha()*100));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,11 @@ public class ColorRGBAPropertyEditor implements PropertyEditor {
|
|||||||
|
|
||||||
public void setValue(Object value) {
|
public void setValue(Object value) {
|
||||||
if (value instanceof ColorRGBA) {
|
if (value instanceof ColorRGBA) {
|
||||||
color.set((ColorRGBA) value);
|
if (color == null) {
|
||||||
|
color = new ColorRGBA((ColorRGBA) value);
|
||||||
|
} else {
|
||||||
|
color.set((ColorRGBA) value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,11 +65,19 @@ public class ColorRGBAPropertyEditor implements PropertyEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPaintable() {
|
public boolean isPaintable() {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paintValue(Graphics gfx, Rectangle box) {
|
public void paintValue(Graphics gfx, Rectangle box) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
final int width = box.height - 2;
|
||||||
|
final int height = box.height - 2;
|
||||||
|
java.awt.Color oldColor = gfx.getColor();
|
||||||
|
gfx.setColor(java.awt.Color.BLACK);
|
||||||
|
gfx.drawRect(box.x, box.y + 1, width, height);
|
||||||
|
gfx.setColor(new java.awt.Color(color.asIntARGB(), true));
|
||||||
|
gfx.fillRect(box.x + 1, box.y + 2, width - 1, height - 1);
|
||||||
|
gfx.setColor(oldColor);
|
||||||
|
gfx.drawString(getAsText(), box.x + width + 5, box.y + (box.height / 2) + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJavaInitializationString() {
|
public String getJavaInitializationString() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user