Answers for "how to drag undecorated stage in javafx"

1

how to make stage dragable in javafx

private double x = 0;
    private double y = 0;

    private void makeCanDrag()	//make sure this method is called at the start.
    {

        parent.setOnMousePressed(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                x = event.getSceneX();
                y = event.getSceneY();
            }
        });

        parent.setOnMouseDragged(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
                stage.setX(eve
Posted by: Guest on April-18-2020

Code answers related to "how to drag undecorated stage in javafx"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language