List of usage examples for javafx.scene.layout StackPane StackPane
public StackPane()
From source file:Main.java
@Override public void start(Stage stage) { Group group = new Group(); Scene scene = new Scene(group); StackPane stack = new StackPane(); stack.getChildren().addAll(new Rectangle(100, 100, Color.BLUE)); group.getChildren().add(stack);//from w w w .j a v a2 s .c o m stage.setTitle("Welcome to JavaFX!"); stage.setScene(scene); stage.sizeToScene(); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Group group = new Group(); Scene scene = new Scene(group); StackPane stack = new StackPane(); stack.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE); stack.getChildren().addAll(new Rectangle(100, 100, Color.BLUE)); group.getChildren().add(stack);// www . j av a2s. co m stage.setTitle("Welcome to JavaFX!"); stage.setScene(scene); stage.sizeToScene(); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Group group = new Group(); Scene scene = new Scene(group); Label title = new Label("Label 1"); StackPane stackpane = new StackPane(); StackPane.setAlignment(title, Pos.BOTTOM_CENTER); stackpane.getChildren().addAll(new Label("Label"), title); group.getChildren().add(stackpane);//from w w w. j av a 2s . c o m stage.setTitle("Welcome to JavaFX!"); stage.setScene(scene); stage.sizeToScene(); stage.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);/*from www . j av a 2 s. c om*/ stage.setTitle("Welcome to JavaFX!"); stage.setScene(scene); stage.sizeToScene(); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("BorderPane Test"); //Creating StackPane StackPane sp = new StackPane(); ////from w w w.j a v a2s .c o m Label lbl = new Label("JavaFX 2 StackPane"); sp.getChildren().add(lbl); Button btn = new Button("Button"); sp.getChildren().add(btn); //Adding StackPane to the scene Scene scene = new Scene(sp, 300, 200); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(final Stage primaryStage) { StackPane sp = new StackPane(); Button btnOpen = new Button("Open Dialog"); sp.getChildren().add(btnOpen);// w ww . ja v a2s .co m btnOpen.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent event) { Stage stage = new Stage(); Scene page2 = new Scene(new Group(new Text(20, 20, "This is a new dialog!"))); stage.setScene(page2); stage.show(); } }); Scene scene = new Scene(sp, 300, 200); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { PieChart pieChart = new PieChart(); pieChart.setData(getChartData());/*www . java 2 s . c o m*/ primaryStage.setTitle("PieChart"); StackPane root = new StackPane(); root.getChildren().add(pieChart); primaryStage.setScene(new Scene(root, 400, 250)); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Button btn = new Button(); btn.setText("Say 'Hello World'"); btn.setOnAction(new EventHandler<ActionEvent>() { @Override/* w w w .j a va 2 s .c om*/ public void handle(ActionEvent event) { System.out.println("Hello World!"); } }); StackPane root = new StackPane(); root.getChildren().add(btn); Scene scene = new Scene(root, 300, 250); primaryStage.setTitle("Hello World!"); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { TreeItem<String> rootItem = new TreeItem<>("Root"); rootItem.setExpanded(true);/*from w ww . j a v a 2 s. c o m*/ TreeItem<String> item = new TreeItem<>("A"); rootItem.getChildren().add(item); item = new TreeItem<>("B"); rootItem.getChildren().add(item); TreeView<String> tree = new TreeView<>(rootItem); StackPane root = new StackPane(); root.getChildren().add(tree); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { CategoryAxis xAxis = new CategoryAxis(); NumberAxis yAxis = new NumberAxis(); AreaChart areaChart = new AreaChart(xAxis, yAxis, getChartData()); areaChart.setTitle("speculations"); primaryStage.setTitle("AreaChart example"); StackPane root = new StackPane(); root.getChildren().add(areaChart);/*from ww w .j av a 2 s.c o m*/ primaryStage.setScene(new Scene(root, 400, 250)); primaryStage.show(); }