Java Reference
In-Depth Information
Listing 6.1
Adding a DropShadow to a Text Node
import javafx.stage.*;
import javafx.scene.*;
import javafx.scene.paint.*;
import javafx.scene.text.*;
import javafx.scene.effect.*;
Stage {
title: "DropShadow"
width: 250
height: 100
scene: Scene {
content: [
Text {
font: Font {
size: 32
}
x: 15, y: 40
fill: Color.DARKRED
content: "JavaFX effects"
effect: DropShadow {
offsetX: 3
offsetY: 3
}
}
]
}
}
Figure 6.2 depicts what would be displayed if the code in Listing 6.1 were to be
compiled and executed.
Figure 6.2
Text with DropShadow
Figure 6.3 demonstrates how, by changing the values of the instance variables of
DropShadow , you can achieve different shadow effects.
 
Search WWH ::




Custom Search