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(event.getSceneX() -