JavaFX DropShadow effect

Description

JavaFX DropShadow effect

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.effect.DropShadow;
import javafx.scene.layout.Pane;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class Main extends Application {
  public static void main(String[] args) {
    Application.launch(args);// w  w w. j  ava2 s. c  o m
  }

  @Override
  public void start(Stage stage) {
    Text t1 = new Text("demo2s.com");
    t1.setFont(Font.font(24));
    t1.setEffect(new DropShadow());

    Pane root = new Pane();
    root.getChildren().add(t1);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Drawing on a Canvas");
    stage.show();
  }
}



PreviousNext

Related