Search in sources :

Example 11 with ColorChooserButton

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;
}
Also used : ColorChooserButtonSelectionListener(org.apache.pivot.wtk.ColorChooserButtonSelectionListener) ColorChooserButton(org.apache.pivot.wtk.ColorChooserButton) Color(java.awt.Color)

Aggregations

ColorChooserButton (org.apache.pivot.wtk.ColorChooserButton)11 Button (org.apache.pivot.wtk.Button)7 Color (java.awt.Color)6 GradientPaint (java.awt.GradientPaint)5 Point (org.apache.pivot.wtk.Point)5 ColorChooserButtonSelectionListener (org.apache.pivot.wtk.ColorChooserButtonSelectionListener)3 ButtonPressListener (org.apache.pivot.wtk.ButtonPressListener)2 PushButton (org.apache.pivot.wtk.PushButton)2 NumericSpinnerData (org.apache.pivot.wtk.content.NumericSpinnerData)2 BasicStroke (java.awt.BasicStroke)1 Font (java.awt.Font)1 Graphics2D (java.awt.Graphics2D)1 GeneralPath (java.awt.geom.GeneralPath)1 RoundRectangle2D (java.awt.geom.RoundRectangle2D)1 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileReader (java.io.FileReader)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 BXMLSerializer (org.apache.pivot.beans.BXMLSerializer)1