Hello, I’m using an undecorated JavaFX window (stage) and want to be able to resize it. I grabbed the following code and got it working (sort of):
resizeButton.setOnMousePressed(new EventHandler<MouseEvent>() {
public void handle(MouseEvent e) {
dx = JavaGameMaker.editorWindow.getWidth() - e.getX();
dy = JavaGameMaker.editorWindow.getHeight() - e.getY();
}
});
resizeButton.setOnMouseDragged(new EventHandler<MouseEvent>() {
public void handle(MouseEvent event) {
JavaGameMaker.editorWindow.setWidth(event.getX() + dx);
JavaGameMaker.editorWindow.setHeight(event.getY() + dy);
}
});
I’m using a borderless button at the bottom right corner, that the user can grab to resize the window.
What happen’s is this:
(http://imgur.com/4Az2WFF - sorry for the bad quality, imgur made some problems)
The corner doesn’t stay at the cursor.
Has anybody got an idea, on how to fix this?