import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.effect.InnerShadow; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.stage.Stage; public class TestCanvasApplyIS extends Application { public static void main(String[] argv) { launch(argv); } @Override public void start(Stage stage) { Canvas cv = new Canvas(320, 320); GraphicsContext gc = cv.getGraphicsContext2D(); gc.setFont(Font.font(null, 80)); gc.setFill(Color.YELLOW); gc.fillText("XA", 17, 75); gc.setFill(Color.LIGHTBLUE); gc.fillRect(17, 85, 100, 40); gc.applyEffect(new InnerShadow(10, 10, 20, Color.BLACK)); Group root = new Group(cv); stage.setScene(new Scene(root, 320, 320)); stage.show(); } }