Combining effects

By combining just reflection and shadow effects, you can already achieve nice-looking elements, for example:

Refer to the following code snippet:

// chapter8/combining/ReflectionAndShadows.javapublic void start(Stage stage) {    // outer rectangle has a inner shadow    Rectangle rect = new Rectangle(120, 120);    rect.setFill(Color.WHITE);    rect.setStroke(Color.BLACK);    rect.setStrokeWidth(4);    rect.setEffect(new InnerShadow(15, Color.BLACK));    // text has a drop shadow    Text text = new Text("FX");    text.setFont(Font.font("Arial", FontWeight.BOLD, 80));    text.setEffect(new DropShadow());    // to apply reflection to both // we need to have ...

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.