customColorDialog = new JFXCustomColorPickerDialog(popupControl); customColorDialog.customColorProperty().addListener((ov, t1, t2) -> { colorPicker.setValue(customColorDialog.customColorProperty().get()); }); customColorDialog.setOnSave(() -> { Color customColor = customColorDialog.customColorProperty().get(); buildCustomColors(); colorPicker.getCustomColors().add(customColor); updateSelection(customColor); Event.fireEvent(colorPicker, new ActionEvent()); colorPicker.hide(); }); customColorDialog.setCurrentColor(colorPicker.valueProperty().get()); if (popupControl != null) { popupControl.setAutoHide(false); colorPicker.getCustomColors().addListener((Change<? extends Color> change) -> buildCustomColors()); VBox paletteBox = new VBox(); paletteBox.getStyleClass().add("color-palette"); customColorDialog = new JFXCustomColorPickerDialog(popupControl); customColorDialog.customColorProperty().addListener((ov, t1, t2) -> { colorPicker.setValue(customColorDialog.customColorProperty().get()); }); customColorDialog.setOnSave(() -> { Color customColor = customColorDialog.customColorProperty().get(); buildCustomColors(); colorPicker.getCustomColors().add(customColor);
@Override public void start(Stage stage) { FlowPane main = new FlowPane(); main.setVgap(20); main.setHgap(20); javafx.scene.control.ColorPicker picker = new javafx.scene.control.ColorPicker(Color.RED); picker.getStyleClass().add("button"); // picker.getStyleClass().add("split-button"); main.getChildren().add(picker); main.getChildren().add(new JFXColorPicker()); StackPane pane = new StackPane(); pane.getChildren().add(main); StackPane.setMargin(main, new Insets(100)); pane.setStyle("-fx-background-color:WHITE"); final Scene scene = new Scene(pane, 800, 200); // scene.getStylesheets().add(ButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); stage.setTitle("JFX Button Demo"); stage.setScene(scene); stage.show(); }
button.setMinSize(30,30); button.setMaxSize(30,30); button.ripplerFillProperty().bind(glyphDetailViewer.colorPicker.valueProperty()); glyphDetailViewer.colorPicker.valueProperty().addListener((o, oldVal, newVal) -> { String webColor = "#" + Integer.toHexString(newVal.hashCode()).substring(0, 6).toUpperCase(); Consumer<String> lookupConsumer = lookup->{ lookupConsumer.accept(ANIMATED_THUMB); if (lastClicked != null) { final String currentColor = glyphDetailViewer.colorPicker.getValue() .toString() .substring(0, 8); lastClicked.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, lastClicked.getBackground().getFills().get(0).getRadii(), null))); final String currentColor = glyphDetailViewer.colorPicker.getValue() .toString() .substring(0, 8);
if (!dragDetected) { dragDetected = true; mouseDragColor = colorPicker.getValue(); (int) t.getY() / (SQUARE_SIZE + 1), NUM_OF_ROWS - 1); int index = xIndex + yIndex * NUM_OF_COLUMNS; colorPicker.setValue((Color) squares.get(index).rectangle.getFill()); updateSelection(colorPicker.getValue()); }); addEventHandler(MouseEvent.MOUSE_RELEASED, t -> { if (colorPickerGrid.getBoundsInLocal().contains(t.getX(), t.getY())) { updateSelection(colorPicker.getValue()); colorPicker.fireEvent(new ActionEvent()); colorPicker.hide(); } else { colorPicker.setValue(mouseDragColor); updateSelection(mouseDragColor);
private Tab createColorTab() { Tab t = new Tab(); t.setText(Messages.getString("PaintEditor.Color")); //$NON-NLS-1$ GridLayoutPane p = new GridLayoutPane(); p.setNumColumns(3); Rectangle solidPreview = new Rectangle(PREVIEW_SIZE, PREVIEW_SIZE); this.solidPreview = solidPreview; GridLayoutPane dataPane = new GridLayoutPane(); dataPane.setNumColumns(2); ColorPicker picker = new ColorPicker(); picker.valueProperty().addListener((o) -> { solidPreview.setFill(picker.getValue()); this.paint.set(picker.getValue()); }); dataPane.getChildren().addAll(new Label(Messages.getString("PaintEditor.Color")), picker); //$NON-NLS-1$ Color color = (Color) this.paint.get(); if (color instanceof Color) { picker.setValue(color); } TitledPane dtp = new TitledPane(Messages.getString("PaintEditor.Data"), dataPane); //$NON-NLS-1$ dtp.setCollapsible(false); TitledPane pane = new TitledPane(Messages.getString("PaintEditor.Preview"), solidPreview); //$NON-NLS-1$ pane.setCollapsible(false); GridLayoutPane.setConstraint(dtp, new GridData(Alignment.FILL, Alignment.FILL, true, true)); GridLayoutPane.setConstraint(pane, new GridData(Alignment.BEGINNING, Alignment.BEGINNING, false, false)); p.getChildren().addAll(pane, dtp); t.setContent(p); return t; }
private ColorPicker createBaseColorPicker() { ColorPicker colorPicker = new ColorPicker(Color.TRANSPARENT); colorPicker.getCustomColors().addAll(Color.TRANSPARENT, Color.web("#f3622d"), Color.web("#fba71b"), Color.web("#57b757"), Color.web("#41a9c9"), Color.web("#888"), Color.RED, Color.ORANGE, Color.YELLOW, Color.GREEN, Color.CYAN, Color.BLUE, Color.PURPLE, Color.MAGENTA, Color.BLACK); colorPicker.valueProperty().addListener(new ChangeListener<Color>() { @Override public void changed(ObservableValue<? extends Color> observable, Color oldValue, Color c) { setBaseColor(c); } }); return colorPicker; }
@Override public Node createValueVisualisation() { ColorPicker colorPicker = new ColorPicker(); colorPicker.valueProperty().bindBidirectional(observableAttributeValue); return colorPicker; } }
ObjectProperty<Paint> op = label.textFillProperty(); ColorPicker cp = new ColorPicker(Color.GRAY); ... op.bind(cp.valueProperty());
}); panCircles.setPrefSize(400, 400); ColorPicker colorPicker = new ColorPicker(); colorPicker.showingProperty().addListener((obs,b,b1)->{ if(b1){ final ColorPicker picker = new ColorPicker(); picker.setStyle("-fx-border-radius: 10 10 10 10;" + "-fx-background-radius: 10 10 10 10;"); picker.setValue((Color)(circle.getFill())); picker.valueProperty().addListener((obs,c0,c1)->circle.setFill(c1));
public static final PropertyEditor<?> createColorEditor( Item property ) { return new AbstractPropertyEditor<Color, ColorPicker>(property, new ColorPicker()) { @Override protected ObservableValue<Color> getObservableValue() { return getEditor().valueProperty(); } @Override public void setValue(Color value) { getEditor().setValue((Color) value); } }; }
colorPicker.focusedProperty().addListener(observable -> { if (colorPicker.isFocused()) { if (!getSkinnable().isPressed()) { rippler.setOverlayVisible(true); registerChangeListener(colorPicker.valueProperty(), "VALUE"); colorLabelVisible.addListener(invalidate -> { if (displayNode != null) {
colorPicker = new ColorPicker(); colorPicker.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent evt) { colorPicker.setUserData(value); colorPicker.setValue(value.getColor()); setGraphic(colorPicker);
Hbox layout =new HBox(10); ColorPicker colorPicker = new ColorPicker(); colorPicker.setValue(Color.RED);//Red is the default shown at first Label label =new Label("Your Text"); layout.getChildren().addAll(label,colorPicker); //Then colorPicker.setOnAction(event->{ label.setFill(colorPicker.getValue()); });
@Override public void changed(ObservableValue<? extends AuditralColorMapping> observable, AuditralColorMapping oldValue, AuditralColorMapping newValue) { if (oldValue != null) { colorDetail.valueProperty().unbindBidirectional(oldValue.color); occurrenceDetail.textProperty().unbindBidirectional(oldValue.occurrenceRegEx); loglevelDetail.textProperty().unbindBidirectional(oldValue.loglevelRegEx); workflowidDetail.textProperty().unbindBidirectional(oldValue.workflowInstanceIdRegEx); correlationidDetail.textProperty().unbindBidirectional(oldValue.correlationIdRegEx); conversionidDetail.textProperty().unbindBidirectional(oldValue.conversationIdRegEx); messageTypDetail.textProperty().unbindBidirectional(oldValue.messageTypeRegEx); idDetail.textProperty().unbindBidirectional(oldValue.idRegEx); } if (newValue != null) { colorDetail.valueProperty().bindBidirectional(newValue.color); occurrenceDetail.textProperty().bindBidirectional(newValue.occurrenceRegEx); loglevelDetail.textProperty().bindBidirectional(newValue.loglevelRegEx); workflowidDetail.textProperty().bindBidirectional(newValue.workflowInstanceIdRegEx); correlationidDetail.textProperty().bindBidirectional(newValue.correlationIdRegEx); conversionidDetail.textProperty().bindBidirectional(newValue.conversationIdRegEx); messageTypDetail.textProperty().bindBidirectional(newValue.messageTypeRegEx); idDetail.textProperty().bindBidirectional(newValue.idRegEx); colorDetail.fireEvent(new ActionEvent());// javafx bug workaround else color chooser wont update // http://javafx-jira.kenai.com/browse/RT-26633 } } });
@Override public void start(Stage primaryStage) { ColorPicker picker = new ColorPicker(); StackPane root = new StackPane(picker); Scene scene = new Scene(root, 500, 400); primaryStage.setScene(scene); primaryStage.show(); picker.showingProperty().addListener((obs,b,b1)->{ if(b1){ PopupWindow popupWindow = getPopupWindow(); Node popup = popupWindow.getScene().getRoot().getChildrenUnmodifiable().get(0); popup.lookupAll(".color-rect").stream() .forEach(rect->{ Color c = (Color)((Rectangle)rect).getFill(); Tooltip.install(rect.getParent(), new Tooltip("Custom tip for "+c.toString())); }); } }); }
@Override public void show() { super.show(); final ColorPicker colorPicker = (ColorPicker) getSkinnable(); popupContent.updateSelection(colorPicker.getValue()); }
@Override public void setValue(Color value) { getEditor().setValue((Color) value); } };
private void buildCustomColors() { final ObservableList<Color> customColors = colorPicker.getCustomColors(); customColorGrid.getChildren().clear(); if (customColors.isEmpty()) {