use of org.apache.pivot.wtk.ColorChooserButton in project pivot by apache.
the class ComponentInspectorSkin method addColorControl.
private static Component addColorControl(final Dictionary<String, Object> dictionary, final String key, Form.Section section) {
Color color = dictionary.getColor(key);
ColorChooserButton colorChooserButton = new ColorChooserButton();
colorChooserButton.setSelectedColor(color);
section.add(colorChooserButton);
Form.setLabel(colorChooserButton, key);
colorChooserButton.getColorChooserButtonSelectionListeners().add(new ColorChooserButtonSelectionListener() {
@Override
public void selectedColorChanged(ColorChooserButton colorChooserButtonArgument, Color previousSelectedColor) {
try {
dictionary.put(key, colorChooserButtonArgument.getSelectedColor());
} catch (Exception exception) {
displayErrorMessage(exception, colorChooserButtonArgument.getWindow());
dictionary.put(key, previousSelectedColor);
}
}
});
return colorChooserButton;
}
Aggregations