Using DropShadow

The javafx.scene.effect.DropShadow effect is a shadow which imitates different light source locations, and is drawn outside the shadowed node, as in the following example:

To add DropShadow, you just need to instantiate a corresponding class with the desired parameters:

// chapter8/basiceffects/DropShadowDemo.javapublic void start(Stage stage) throws Exception {    Circle red = new Circle(50, Color.RED);    red.setEffect(new DropShadow());    Circle yellow = new Circle(50, Color.YELLOW);    yellow.setEffect(new DropShadow(           10,      // shadow radius           10, 0,   // x,y offset           Color.DARKGRAY));    Circle green = new Circle(50, Color.GREEN); green.setEffect(new ...

Get Mastering JavaFX 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.