On Wed, 10 Dec 2025 05:34:52 GMT, Michael Strauß <[email protected]> wrote:
> An extended stage seems to hang after a drag and drop operation. Note that in
> the attached reproducer, the application seems unresponsive until the mouse
> cursor leaves and re-enters the application window:
>
>
> import javafx.application.Application;
> import javafx.scene.Scene;
> import javafx.scene.control.Label;
> import javafx.scene.input.ClipboardContent;
> import javafx.scene.input.Dragboard;
> import javafx.scene.input.TransferMode;
> import javafx.scene.layout.BorderPane;
> import javafx.scene.layout.HBox;
> import javafx.scene.layout.HeaderBar;
> import javafx.stage.Stage;
> import javafx.stage.StageStyle;
>
> public class DragDropTest extends Application {
>
> @Override
> public void start(Stage primaryStage) {
>
> primaryStage.initStyle(StageStyle.EXTENDED);
>
> // Create drag source
> Label dragSource = new Label("Drag me!");
> dragSource.setStyle("-fx-background-color: lightblue; -fx-padding:
> 10px");
>
> // Create drop target
> Label dropTarget = new Label("Drop here!");
> dropTarget.setStyle("-fx-background-color: lightcoral; -fx-padding:
> 20px; -fx-min-width: 150px; -fx-min-height: 100px;");
>
> // Set up drag detection
> dragSource.setOnDragDetected(event -> {
> Dragboard dragboard =
> dragSource.startDragAndDrop(TransferMode.COPY);
> ClipboardContent content = new ClipboardContent();
> content.putString("Hello from drag source!");
> dragboard.setContent(content);
> event.consume();
> });
>
> // Set up drag over
> dropTarget.setOnDragOver(event -> {
> if (event.getGestureSource() != dropTarget &&
> event.getDragboard().hasString()) {
> event.acceptTransferModes(TransferMode.COPY);
> }
> event.consume();
> });
>
> // Set up drag entered (visual feedback)
> dropTarget.setOnDragEntered(event -> {
> if (event.getGestureSource() != dropTarget &&
> event.getDragboard().hasString()) {
> dropTarget.setStyle("-fx-background-color: lightgreen;
> -fx-padding: 20px; -fx-min-width: 150px; -fx-min-height: 100px;");
> }
> event.consume();
> });
>
> // Set up drag exited (reset visual feedback)
> dropTarget.setOnDragExited(event -> {
> dropTarget.setStyle("-fx-background-color: lightcoral;
> -fx-padding: 20px; -fx-min-width: 150px; -fx-min-height: 100px;");
> event.consume();
> });
>
> // Set up drop
> dropTarget.setOnD...
Thank you, tested this on Windows with a dnd docking framework and found no
issues post fix.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/2003#issuecomment-3674082329