@FXML void onColorButtonAction(ActionEvent event) { final ToggleButton tb = (ToggleButton) event.getTarget(); assert tb == colorToggleButton; final Color value = colorPicker.getValue(); // Update UI setMode(value); // Update model setPaintProperty(value); event.consume(); }
public void updateUI(Paint value) { if (value != null) { setMode(value); if (value instanceof Color) { colorPicker.updateUI((Color) value); } else if (value instanceof LinearGradient) { gradientPicker.updateUI((LinearGradient) value); } else if (value instanceof RadialGradient) { gradientPicker.updateUI((RadialGradient) value); } else { // Case not yet handled assert value instanceof ImagePattern; } } }