diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.java index ce17af394..4e535632a 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.java @@ -53,6 +53,7 @@ public class ColorRGBADialog extends javax.swing.JDialog { super(parent, modal); this.editor = editor; initComponents(); + jColorChooser1.setColor(new Color(((ColorRGBA)editor.getValue()).asIntARGB())); alphaSlider.setValue(Math.round(((ColorRGBA)editor.getValue()).getAlpha()*100)); } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBAPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBAPropertyEditor.java index a5e321b72..7733b1a69 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBAPropertyEditor.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBAPropertyEditor.java @@ -52,7 +52,11 @@ public class ColorRGBAPropertyEditor implements PropertyEditor { public void setValue(Object value) { 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() { - return false; + return true; } 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() {