RFR: 8367557: Extended stage seems to hang after drag and drop
Michael Strauß
mstrauss at openjdk.org
Wed Jan 7 23:34:59 UTC 2026
On Wed, 10 Dec 2025 05:34:52 GMT, Michael Strauß <mstrauss at openjdk.org> 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...
> Could this bug be related to [#1936 (comment)](https://github.com/openjdk/jfx/pull/1936#issuecomment-3720278382) ?
No, but I understand the reason for the other bug. Already working on a solution for it.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/2003#issuecomment-3721261402
More information about the openjfx-dev
mailing list