mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
color editor improvement
This commit is contained in:
@@ -96,8 +96,7 @@ public class ColorEditor extends JPanel {
|
|||||||
if (colorField == null) {
|
if (colorField == null) {
|
||||||
Color color = (Color) property.getValue();
|
Color color = (Color) property.getValue();
|
||||||
colorField =
|
colorField =
|
||||||
new JTextField(property.isUnique() ? Integer.toHexString(color.getRGB()).substring(2).toUpperCase()
|
new JTextField(property.isUnique() ? Integer.toHexString(color.getRGB()).substring(2).toUpperCase() : "");
|
||||||
: ("(multi value) " + title));
|
|
||||||
colorField.setColumns(6);
|
colorField.setColumns(6);
|
||||||
colorField.getDocument().addDocumentListener(new DocumentListener() {
|
colorField.getDocument().addDocumentListener(new DocumentListener() {
|
||||||
|
|
||||||
@@ -123,8 +122,12 @@ public class ColorEditor extends JPanel {
|
|||||||
private void updateColor() {
|
private void updateColor() {
|
||||||
if (getColorField().getText().length() == 6) {
|
if (getColorField().getText().length() == 6) {
|
||||||
Color newColor = Color.decode("#" + getColorField().getText());
|
Color newColor = Color.decode("#" + getColorField().getText());
|
||||||
if (newColor != null)
|
if (newColor != null && getColorLabel().getBackground() != newColor) {
|
||||||
getColorLabel().setBackground(newColor);
|
getColorLabel().setBackground(newColor);
|
||||||
|
getColorLabel().setText(title);
|
||||||
|
property.setChanged(true);
|
||||||
|
property.setValue(newColor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user