Lighting is a complex effect dedicated to giving an object pseudo-3D depth by imitating a light source. An algorithm finds node boundaries and graphically elevates them by shading those further from the imaginary light and lighting the closer ones:
To achieve this effect, you'll have to set the location and type of an imaginary light, which shines on the scene and is implemented as shown in the following code snippet:
// chapter8/light/LightingDemo.java
public void start(Stage primaryStage) {
Light.Distant light = new Light.Distant();
light.setAzimuth(-135);
Lighting lighting = new Lighting();
lighting.setLight(light);
lighting.setSurfaceScale(5);
Text text = new Text("FX");
text.setFill(Color.STEELBLUE);
text.setFont(Font.font(null, FontWeight.BOLD, 70));
text.setEffect(lighting);
Rectangle rect = new Rectangle...