JavaFX Shadow effect
import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.effect.InnerShadow; import javafx.scene.layout.FlowPane; import javafx.scene.paint.Color; import javafx.stage.Stage; public class Main extends Application { boolean shadow = false; InnerShadow innerShadow = new InnerShadow(10.0, Color.RED); // Create four push buttons. private Button btn = new Button("Click to see effect"); public static void main(String[] args) { launch(args);/* w w w .j a va 2 s.c om*/ } public void start(Stage myStage) { myStage.setTitle("Effects Demo"); FlowPane rootNode = new FlowPane(10, 10); rootNode.setAlignment(Pos.CENTER); Scene myScene = new Scene(rootNode, 300, 100); myStage.setScene(myScene); btn.setEffect(innerShadow); btn.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent ae) { // Each time button is pressed, its shadow status is changed. shadow = !shadow; if (shadow) { btn.setEffect(innerShadow); btn.setText("Shadow on"); } else { btn.setEffect(null); btn.setText("Shadow off"); } } }); // Add the label and buttons to the scene graph. rootNode.getChildren().addAll(btn); // Show the stage and its scene. myStage.show(); } }