Monday, February 2, 2009

JavaFX fullScreen

Writing a JavaFX full screen application is easy. Just set the fullScreen property of a Stage to true.

Stage {
title: "Application title"
fullScreen: true
scene: Scene {
content: [
SwingButton {
text: "Exit"
action: function() {
System.exit(0)
}
}
]
}
}
There are some problems with that documented in the documentation of the fullScreen property.

Setting the property to true tries to set the application to full screen using various techniques. All of which you would have to write on your own if you want to support multiple platforms.

The consequence of that is that in the current version of JavaFx you can not switch an application to full screen and then switch it back again.

There is a workaround for that mentioned in the documentation of the fullScreen property. You have to use two stages. One for full screen one for windowed and switch between these two.

I have not tried out that but it seams to be easy.
Post a Comment