public void selectColor(KeyEvent event) { if (rectangle.getFill() != null) { if (rectangle.getFill() instanceof Color) { colorPicker.setValue((Color) rectangle.getFill()); colorPicker.fireEvent(new ActionEvent()); } event.consume(); } colorPicker.hide(); } }
if (!isEmpty) { Color fill = (Color) rectangle.getFill(); colorPicker.setValue(fill); colorPicker.fireEvent(new ActionEvent()); updateSelection(fill);
customColorDialog = new JFXCustomColorPickerDialog(popupControl); customColorDialog.customColorProperty().addListener((ov, t1, t2) -> { colorPicker.setValue(customColorDialog.customColorProperty().get()); }); customColorDialog.setOnSave(() -> { customColorDialog = new JFXCustomColorPickerDialog(popupControl); customColorDialog.customColorProperty().addListener((ov, t1, t2) -> { colorPicker.setValue(customColorDialog.customColorProperty().get()); }); customColorDialog.setOnSave(() -> {
@Override public void setValue(Color value) { getEditor().setValue((Color) value); } };
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()); });
public void setStop(Stop stop) { this.stop = stop; if (this.inSet) { return; } try { this.inSet = true; if (stop != null) { this.picker.setValue(stop.getColor()); this.f.setText(FORMAT.format(stop.getOffset())); setDisable(false); } else { setDisable(true); } } finally { this.inSet = false; } }
public void setStop(Stop stop) { this.stop = stop; if (this.inSet) { return; } try { this.inSet = true; if (stop != null) { this.picker.setValue(stop.getColor()); this.f.setText(FORMAT.format(stop.getOffset())); setDisable(false); } else { setDisable(true); } } finally { this.inSet = false; } }
colorPicker.setValue(value.getColor()); setGraphic(colorPicker);
public void selectColor(KeyEvent event) { if (rectangle.getFill() != null) { if (rectangle.getFill() instanceof Color) { colorPicker.setValue((Color) rectangle.getFill()); colorPicker.fireEvent(new ActionEvent()); } event.consume(); } colorPicker.hide(); } }
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));
if (!isEmpty) { Color fill = (Color) rectangle.getFill(); colorPicker.setValue(fill); colorPicker.fireEvent(new ActionEvent()); updateSelection(fill);
customColorDialog = new JFXCustomColorPickerDialog(popupControl); customColorDialog.customColorProperty().addListener((ov, t1, t2) -> { colorPicker.setValue(customColorDialog.customColorProperty().get()); }); customColorDialog.setOnSave(() -> { customColorDialog = new JFXCustomColorPickerDialog(popupControl); customColorDialog.customColorProperty().addListener((ov, t1, t2) -> { colorPicker.setValue(customColorDialog.customColorProperty().get()); }); customColorDialog.setOnSave(() -> {
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 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; }