integrated change described in this thread to the ColorRGBAPropertyEditor

http://hub.jmonkeyengine.org/t/colorrgbapropertyeditor-a-little-improvement/31552
experimental
Nehon 10 years ago
parent 4cb007f3b3
commit ac7d8d0674
  1. 1
      sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.java
  2. 16
      sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBAPropertyEditor.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));
}

@ -52,20 +52,32 @@ public class ColorRGBAPropertyEditor implements PropertyEditor {
public void setValue(Object value) {
if (value instanceof ColorRGBA) {
if (color == null) {
color = new ColorRGBA((ColorRGBA) value);
} else {
color.set((ColorRGBA) value);
}
}
}
public Object getValue() {
return color;
}
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() {

Loading…
Cancel
Save