[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    RE: Mouse events blocked during DnD inside JFXPanel - bug or limitation?
From:       "Fisher, Robert" <robert.fisher.ext () zeiss ! com>
Date:       2016-05-27 8:10:15
Message-ID: 025E25CA98F8AE46BE306AB33F6A38D5012D1EF7 () ADEFUE01SMS003 ! cznet ! zeiss ! org
[Download RAW message or body]

Sorry I forgot to add - I'm using 1.8.0_66 on Windows 7.

Cheers,
Rob

-----Original Message-----
From: openjfx-dev [mailto:openjfx-dev-bounces@openjdk.java.net] On Behalf Of Fisher, \
                Robert
Sent: Freitag, 27. Mai 2016 10:07
To: openjfx-dev@openjdk.java.net
Subject: Mouse events blocked during DnD inside JFXPanel - bug or limitation?

Hi all,

When inside a JFXPanel, after DnD has been started on a node and content put the \
dragboard, mouse-exited events for the node do not fire until the drag gesture is \
over.

Is this a known bug, new bug, or a limitation of using Swing + FX together?

Check out the test program below. Any input would be appreciated.

Cheers,
Rob

public class Main extends Application {

    // Set to true to test behaviour when embedded inside a JFXPanel.
    private static final boolean EMBED_IN_SWING = true;

    public static void main(String[] args) {
        if (EMBED_IN_SWING) {
            SwingUtilities.invokeLater(() -> {
                JFXPanel jfxPanel = new JFXPanel();
                JFrame frame = new JFrame();
                frame.add(jfxPanel);
                frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                frame.setSize(800, 600);
                frame.setVisible(true);
                Platform.runLater(() -> {
                    Scene scene = createScene();
                    jfxPanel.setScene(scene);
                });
            });
        } else {
            launch(args);
        }
    }

    @Override
    public void start(Stage primaryStage) {
        Scene scene = createScene();
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    private static Scene createScene() {
        Rectangle rectangle = new Rectangle(50, 50);

        rectangle.hoverProperty().addListener((v, o, n) -> System.out.println("Hover \
                property: " + n));
        rectangle.addEventFilter(MouseEvent.MOUSE_ENTERED, event -> \
                System.out.println("Mouse entered"));
        rectangle.addEventFilter(MouseEvent.MOUSE_EXITED, event -> \
System.out.println("Mouse exited"));

        rectangle.setOnDragDetected(event -> {
            Dragboard db = rectangle.startDragAndDrop(TransferMode.COPY);
            ClipboardContent content = new ClipboardContent();
            content.putString("Hello World");
            db.setContent(content);
            event.consume();
        });

        StackPane stackPane = new StackPane(rectangle);
        return new Scene(stackPane, 800, 600);
    }
}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic