@Override public void show() { super.show(); final ColorPicker colorPicker = (ColorPicker) getSkinnable(); popupContent.updateSelection(colorPicker.getValue()); }
if (!dragDetected) { dragDetected = true; mouseDragColor = colorPicker.getValue(); 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();
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);
private void refreshView() { if (glyph.getValue() == null) { idLabel.setText(""); nameLabel.setText(""); return; } sizeSlider.valueProperty().addListener(observable -> glyph.get().setSize(sizeSlider.getValue())); idLabel.setText(String.format("%04d", glyph.get().getGlyphId())); nameLabel.setText(glyph.get().getName()); glyph.get().setFill(colorPicker.getValue()); glyph.get().fillProperty().bind(colorPicker.valueProperty()); centeredGlyph.getChildren().setAll(glyph.get()); }
private void updateColor() { final ColorPicker colorPicker = (ColorPicker) getSkinnable(); Color color = colorPicker.getValue(); // update picker box color Color circleColor = color == null ? Color.WHITE : color; Circle colorCircle = new Circle(); colorCircle.setFill(circleColor); colorCircle.setLayoutX(colorBox.getWidth() / 4); colorCircle.setLayoutY(colorBox.getHeight() / 2); colorBox.getChildren().add(colorCircle); Timeline animateColor = new Timeline(new KeyFrame(Duration.millis(240), new KeyValue(colorCircle.radiusProperty(), 200, Interpolator.EASE_BOTH))); animateColor.setOnFinished((finish) -> { JFXNodeUtils.updateBackground(colorBox.getBackground(), colorBox, colorCircle.getFill()); colorBox.getChildren().remove(colorCircle); }); animateColor.play(); // update label color displayNode.setTextFill(circleColor.grayscale().getRed() < 0.5 ? Color.valueOf( "rgba(255, 255, 255, 0.87)") : Color.valueOf("rgba(0, 0, 0, 0.87)")); if (colorLabelVisible.get()) { displayNode.setText(JFXNodeUtils.colorToHex(circleColor)); } else { displayNode.setText(""); } }
void update(Observable t) { if (this.inSet) { return; } try { this.inSet = true; this.consumer.accept(this.stop, new Stop(parseSafe(this.f.getText(), 0), this.picker.getValue())); } finally { this.inSet = false; } }
void update(Observable t) { if (this.inSet) { return; } try { this.inSet = true; this.consumer.accept(this.stop, new Stop(parseSafe(this.f.getText(), 0), this.picker.getValue())); } finally { this.inSet = false; } }
@Override public void show() { super.show(); final ColorPicker colorPicker = (ColorPicker) getSkinnable(); popupContent.updateSelection(colorPicker.getValue()); }
if (!dragDetected) { dragDetected = true; mouseDragColor = colorPicker.getValue(); 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();
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; }
private void updateColor() { final ColorPicker colorPicker = (ColorPicker) getSkinnable(); Color color = colorPicker.getValue(); // update picker box color Color circleColor = color == null ? Color.WHITE : color; Circle colorCircle = new Circle(); colorCircle.setFill(circleColor); colorCircle.setLayoutX(colorBox.getWidth() / 4); colorCircle.setLayoutY(colorBox.getHeight() / 2); colorBox.getChildren().add(colorCircle); Timeline animateColor = new Timeline(new KeyFrame(Duration.millis(240), new KeyValue(colorCircle.radiusProperty(), 200, Interpolator.EASE_BOTH))); animateColor.setOnFinished((finish) -> { JFXNodeUtils.updateBackground(colorBox.getBackground(), colorBox, colorCircle.getFill()); colorBox.getChildren().remove(colorCircle); }); animateColor.play(); // update label color displayNode.setTextFill(circleColor.grayscale().getRed() < 0.5 ? Color.valueOf( "rgba(255, 255, 255, 0.87)") : Color.valueOf("rgba(0, 0, 0, 0.87)")); if (colorLabelVisible.get()) { displayNode.setText(JFXNodeUtils.colorToHex(circleColor)); } else { displayNode.setText(""); } }