Listener for screen rotation

77 views
Skip to first unread message

ipan...@gmail.com

unread,
May 6, 2015, 3:44:41 AM5/6/15
to javafx...@googlegroups.com
Hi,

is there any listener that detect screen rotation on javaFX that would works for ioS and android. My apps have didn't resize screen if it's rotate.

I want to add clausel to listener like:

if( screen.isRotate() ){
// resize or render new screen
}

Thanks for your help,

Ivan

Ivan Maulana

unread,
May 13, 2015, 7:44:41 AM5/13/15
to javafx...@googlegroups.com, ipan...@gmail.com

Hi,

for someone who interesting on the answer:

scene = stage.getScene();
scene.widthProperty().addListener((observable, oldValue, newValue) -> {
System.out.println("Width has changed from " + oldValue + " to " + newValue
);
});

Johan Vos

unread,
May 21, 2015, 2:13:52 PM5/21/15
to javafx...@googlegroups.com, ipan...@gmail.com
That should work, but your app should also auto-rotate when the screen is rotated. 
Reply all
Reply to author
Forward
0 new messages