List of usage examples for javafx.scene Scene Scene
public Scene(@NamedArg("root") Parent root, @NamedArg("width") double width, @NamedArg("height") double height)
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 450, 250); TilePane tile = new TilePane(); tile.setHgap(8);//from w w w . ja v a 2 s.c om tile.setPrefColumns(4); for (int i = 0; i < 20; i++) { tile.getChildren().add(new CheckBox("CheckBox")); } System.out.println(tile.getTileAlignment()); HBox hbox = new HBox(10); hbox.setPadding(new Insets(20, 0, 0, 20)); hbox.getChildren().setAll(tile); Group root = (Group) scene.getRoot(); root.getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Circle c = new Circle(); Group root = new Group(c); Scene scene = new Scene(root, 100, 100); c.centerXProperty().bind(scene.widthProperty().divide(2)); c.centerYProperty().bind(scene.heightProperty().divide(2)); c.radiusProperty().bind(Bindings.min(scene.widthProperty(), scene.heightProperty()).divide(2)); stage.setTitle("A Centered Circle"); stage.setScene(scene);/*from ww w . j a va 2 s. c o m*/ stage.sizeToScene(); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Text msg = new Text("Hello JavaFX"); VBox root = new VBox(); root.getChildren().add(msg);// w w w .j a v a2 s . c om Scene scene = new Scene(root, 300, 50); stage.setScene(scene); stage.setTitle("Hello JavaFX Application with a Scene"); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { final Group group = new Group(); Scene scene = new Scene(group, 300, 150); stage.setScene(scene);//from w w w . ja va2 s . c o m stage.setTitle("Sample"); Stop[] stops = { new Stop(0, Color.WHITE), new Stop(1, Color.BLACK) }; LinearGradient lg = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, stops); Rectangle r = new Rectangle(20, 20, 200, 200); r.setFill(lg); group.getChildren().add(r); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 450, 250); TextField notification = new TextField(); notification.setText("Label"); notification.clear();// www . j a v a 2s . com GridPane grid = new GridPane(); grid.setVgap(4); grid.setHgap(10); grid.setPadding(new Insets(5, 5, 5, 5)); grid.add(new Label("To: "), 0, 0); grid.add(notification, 1, 0); Group root = (Group) scene.getRoot(); root.getChildren().add(grid); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 450, 250); TilePane tile = new TilePane(); tile.setHgap(8);/*from ww w. j a va 2s . c o m*/ tile.setPrefColumns(4); for (int i = 0; i < 20; i++) { tile.getChildren().add(new CheckBox("CheckBox")); } HBox hbox = new HBox(10); hbox.setPadding(new Insets(20, 0, 0, 20)); hbox.getChildren().setAll(tile); System.out.println(TilePane.getMargin(hbox)); Group root = (Group) scene.getRoot(); root.getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 450, 250); ComboBox<String> emailComboBox = new ComboBox<String>(); emailComboBox.getItems().addAll("A", "B", "C", "D", "E"); emailComboBox.setValue("A"); System.out.println(emailComboBox.getValue()); GridPane grid = new GridPane(); grid.setVgap(4);/*from ww w .ja v a 2 s . c o m*/ grid.setHgap(10); grid.setPadding(new Insets(5, 5, 5, 5)); grid.add(new Label("To: "), 0, 0); grid.add(emailComboBox, 1, 0); Group root = (Group) scene.getRoot(); root.getChildren().add(grid); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250); Button btn = new Button(); btn.setText("Hello World"); btn.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent event) { System.out.println("Hello World"); }/*from ww w . j a v a2 s. c om*/ }); root.getChildren().add(btn); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 450, 250); TilePane tile = new TilePane(); tile.setHgap(8);// w w w .ja v a2 s . c om tile.setPrefColumns(4); for (int i = 0; i < 20; i++) { tile.getChildren().add(new CheckBox("CheckBox")); } HBox hbox = new HBox(10); hbox.setPadding(new Insets(20, 0, 0, 20)); hbox.getChildren().setAll(tile); System.out.println(TilePane.getAlignment(hbox)); Group root = (Group) scene.getRoot(); root.getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 450, 250); TilePane tile = new TilePane(); tile.setHgap(8);// www . j a v a2s . c o m tile.setPrefColumns(4); for (int i = 0; i < 20; i++) { tile.getChildren().add(new CheckBox("CheckBox")); } HBox hbox = new HBox(10); hbox.setPadding(new Insets(20, 0, 0, 20)); hbox.getChildren().setAll(tile); TilePane.clearConstraints(hbox); Group root = (Group) scene.getRoot(); root.getChildren().add(hbox); stage.setScene(scene); stage.show(); }