-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
46 lines (34 loc) · 1.2 KB
/
Main.java
File metadata and controls
46 lines (34 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package sample;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.*;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
HBox hbox = new HBox(50);
VBox vbox0 = new VBox();
VBox vbox1 = new VBox(20);
VBox vbox2 = new VBox(10);
for (int i = 0; i < 5; i++)
{
Button bt = new Button("A-Button " + (i+1));
Button bt2 = new Button("B-Button " + (i+1));
Button bt3 = new Button("C-Button " + (i+1));
vbox0.getChildren().add(bt);
vbox1.getChildren().add(bt2);
vbox2.getChildren().add(bt3);
}
hbox.getChildren().addAll(vbox0, vbox1, vbox2);
Scene scene = new Scene(hbox, 350, 350); // the hbox is the root node
primaryStage.setTitle("Nested HBox and VBox's");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}