Search in sources :

Example 1 with PaintPicker

use of com.fxexperience.javafx.scene.control.paintpicker.PaintPicker in project fxexperience2 by EricCanull.

the class PopupEditor method initializePopup.

private void initializePopup(Object startColor) {
    setText(getPreviewString(startColor));
    color.set((Color) startColor);
    this.textProperty().bind(new StringBinding() {

        {
            bind(color);
        }

        @Override
        protected String computeValue() {
            return getWebColor();
        }
    });
    this.showingProperty().addListener((ov, previousVal, newVal) -> {
        if (newVal) {
            if (!initialized) {
                paintPicker = new PaintPicker(Mode.COLOR);
                editorHost.getChildren().add(getPopupContentNode());
                paintPicker.paintProperty().addListener(paintChangeListener);
            }
            paintPicker.setPaintProperty(color.get());
        }
    });
    rectangle.fillProperty().bind(new ObjectBinding<Paint>() {

        {
            bind(color);
        }

        @Override
        protected Paint computeValue() {
            return getColor();
        }
    });
}
Also used : StringBinding(javafx.beans.binding.StringBinding) PaintPicker(com.fxexperience.javafx.scene.control.paintpicker.PaintPicker) Paint(javafx.scene.paint.Paint)

Aggregations

PaintPicker (com.fxexperience.javafx.scene.control.paintpicker.PaintPicker)1 StringBinding (javafx.beans.binding.StringBinding)1 Paint (javafx.scene.paint.Paint)1