Java Reference
In-Depth Information
Going full-screen
A popular way of running media-rich applications is the use of the full-screen theater mode.
This is a great way to grab the user's attention by hiding all other applications and place the
focus on your application's content. This recipe shows you how to accomplish the same effect
by running your application in full-screen mode.
Getting ready
There is not much in prerequisite for this recipe. You do, however, need to know how to create
a basic JavaFX application and know how to add content to the stage. To refresh your memory,
see Building a JavaFX application .
How to do it...
To go full-screen, you simply set the Boolean value of the fullScreen property on the Stage
object to true as shown in the partial listing given next. You can see the full code listing for
this recipe at ch02/source-code/src/application/FullScreen.fx .
Stage {
title : "Going Full Screen"
width: 300
height: 200
fullScreen :true
scene: Scene {
content: [
Rectangle {
x: 100 y: 50
width: 100 height: 100
arcWidth: 10
arcHeight : 10
fill: Color.RED
Text {
content: "Full\nScreen"
x:110 y:60
fill: Color.WHITE
font:Font {size: 16}
onClose: function():Void {
Alert.inform("You are about to quit the application.");
When you run this code, it will start the application immediately in full-screen mode, hiding all
other content on your desktop.
Search WWH ::

Custom Search