diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/util/control/paintpicker/colorpicker/ColorPicker.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/util/control/paintpicker/colorpicker/ColorPicker.java index 9852abf01..1aad8d911 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/util/control/paintpicker/colorpicker/ColorPicker.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/util/control/paintpicker/colorpicker/ColorPicker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Gluon and/or its affiliates. + * Copyright (c) 2022, 2024, Gluon and/or its affiliates. * All rights reserved. Use is subject to license terms. * * This file is available and licensed under the following license: @@ -38,6 +38,7 @@ import com.oracle.javafx.scenebuilder.kit.util.control.paintpicker.gradientpicker.GradientPickerStop; import javafx.beans.value.ChangeListener; import javafx.event.ActionEvent; +import javafx.event.Event; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.geometry.Bounds; @@ -48,7 +49,9 @@ import javafx.scene.control.TextField; import javafx.scene.input.Clipboard; import javafx.scene.input.ClipboardContent; +import javafx.scene.input.KeyEvent; import javafx.scene.input.MouseEvent; +import javafx.scene.input.ScrollEvent; import javafx.scene.layout.Region; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; @@ -155,6 +158,7 @@ private void initialize() { assert green_textfield != null; assert blue_textfield != null; assert alpha_slider != null; + assert picker_scrollpane != null; hue_slider.setStyle(makeHueSliderCSS()); // Make the grad for hue slider @@ -252,6 +256,11 @@ private void initialize() { picker_region.pressedProperty().addListener(liveUpdateListener); hue_slider.pressedProperty().addListener(liveUpdateListener); alpha_slider.pressedProperty().addListener(liveUpdateListener); + + // Disable ColorPicker movement on focus, by blocking scroll and key (Home, End, PgUp, PgDn, arrows) events + picker_scrollpane.addEventFilter(KeyEvent.ANY, Event::consume); + picker_scrollpane.addEventFilter(ScrollEvent.SCROLL, Event::consume); + // paint combobox add values paintCombobox.getItems().setAll(CSS_CODE, JAVA_CODE); paintCombobox.getSelectionModel().select(0);