List of usage examples for javafx.scene Group getChildren
@Override
public ObservableList<Node> getChildren()
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Text Fonts"); Group g = new Group(); Scene scene = new Scene(g, 550, 250); Rectangle r = new Rectangle(); r.setX(10);/*from w w w.ja va2s . c om*/ r.setY(10); r.setWidth(160); r.setHeight(80); r.setFill(Color.DARKBLUE); Text t = new Text(); t.setText("Bloom!"); t.setFill(Color.YELLOW); t.setFont(Font.font(null, FontWeight.BOLD, 36)); t.setX(25); t.setY(65); g.setCache(true); g.setEffect(new Bloom()); g.getChildren().add(r); g.getChildren().add(t); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle(""); Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(); Button button1 = new Button("Add "); Button button2 = new Button("Remove "); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); hbox.setPrefWidth(400);//from w w w . ja va 2 s. c o m root.getChildren().add(hbox); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Menus"); Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); MenuBar menuBar = new MenuBar(); Menu tools = new Menu("Your Menu"); CheckMenuItem item = new CheckMenuItem(); item.setText("Item 1"); tools.getItems().add(item);/*from ww w. ja va 2 s .c o m*/ tools.getItems().add(CheckMenuItemBuilder.create().text("Item 2").selected(true).build()); menuBar.getMenus().add(tools); menuBar.prefWidthProperty().bind(primaryStage.widthProperty()); root.getChildren().add(menuBar); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250); path = new Path(); path.setStrokeWidth(1);/*from w ww. j a v a 2 s . c o m*/ path.setStroke(Color.BLACK); scene.setOnMouseClicked(mouseHandler); scene.setOnMouseDragged(mouseHandler); scene.setOnMouseEntered(mouseHandler); scene.setOnMouseExited(mouseHandler); scene.setOnMouseMoved(mouseHandler); scene.setOnMousePressed(mouseHandler); scene.setOnMouseReleased(mouseHandler); root.getChildren().add(path); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle(""); Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(8);//space Button button1 = new Button("Add "); Button button2 = new Button("Remove "); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); hbox.setPrefWidth(400);// ww w . ja v a2 s .co m root.getChildren().add(hbox); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Group group = new Group(); Scene scene = new Scene(group); SplitPane sp = new SplitPane(); final StackPane sp1 = new StackPane(); sp1.getChildren().add(new Button("Button One")); final StackPane sp2 = new StackPane(); sp2.getChildren().add(new Button("Button Two")); final StackPane sp3 = new StackPane(); sp3.getChildren().add(new Button("Button Three")); sp.getItems().addAll(sp1, sp2, sp3); sp.setDividerPositions(0.3f, 0.6f, 0.9f); group.getChildren().add(sp); stage.setTitle("Welcome to JavaFX!"); stage.setScene(scene);// w w w . jav a 2 s. c om stage.sizeToScene(); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Title"); final Circle circ = new Circle(40, 40, 30); final Group root = new Group(circ); final Scene scene = new Scene(root, 800, 400, Color.BEIGE); final Text text1 = new Text(25, 25, "java2s.com"); text1.setFill(Color.DARKBLUE); text1.setFont(Font.font(java.awt.Font.SERIF, 25)); final Light.Distant light = new Light.Distant(); light.setAzimuth(-135.0);/*from w w w . j a v a2 s . c om*/ final Lighting lighting = new Lighting(); lighting.setLight(light); lighting.setSurfaceScale(9.0); text1.setEffect(lighting); root.getChildren().add(text1); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(); Button button1 = new Button("Add"); Button button2 = new Button("Remove"); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); hbox.setPrefWidth(400);// w w w .ja v a 2 s. co m hbox.setSpacing(10); root.getChildren().add(hbox); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 300, 150); stage.setScene(scene);//from w ww. j a v a 2s. co m stage.setTitle(""); Path path = new Path(); MoveTo moveTo = new MoveTo(); moveTo.setX(0.0f); moveTo.setY(50.0f); QuadCurveTo quadTo = new QuadCurveTo(); quadTo.setControlX(25.0f); quadTo.setControlY(0.0f); quadTo.setX(50.0f); quadTo.setY(50.0f); path.getElements().add(moveTo); path.getElements().add(quadTo); root.getChildren().add(path); scene.setRoot(root); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(); Button button1 = new Button("Add"); Button button2 = new Button("Remove"); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); hbox.setPrefWidth(400);/*www. ja v a2 s . co m*/ hbox.setFillHeight(true); root.getChildren().add(hbox); primaryStage.setScene(scene); primaryStage.show(); }