/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package test.scenegraph.app; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.layout.Pane; import javafx.stage.Stage; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.effect.Effect; import javafx.scene.effect.Light.Point; import javafx.scene.effect.Lighting; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.scene.text.Font; import javafx.scene.text.Text; public class ShortAppWithoutDependencies52 extends Application { public static void main(String[] args) { Application.launch(args); } @Override public void start(Stage stage) { Effect e = new Lighting() {{ setLight(new Point() {{ setX(70);setY(120);setZ(10);}});}}; Node n = drawNode(e); Pane mainContainer = new Pane(); mainContainer.getChildren().add(n); double width = 600; double height = 400; Scene scene = new Scene(new Group(), width, height); ((Group) scene.getRoot()).getChildren().add(mainContainer); stage.setScene(scene); stage.show(); } public Node drawNode(Effect _e) { VBox vb = new VBox(); Group group = new Group(); group.setEffect(_e); Text text = new Text("XO"); text.setX(10); text.setFont(new Font(80)); text.setFill(Color.YELLOW); group.getChildren().add(text); group.getChildren().add(new Rectangle(10,10, 100, 40) {{ setFill(Color.LIGHTBLUE); }}); vb.getChildren().add(group); return vb; } }