public class PreliminaryButtonDemo extends Application
1: import javafx.application.Application;
2: import javafx.scene.Scene;
3: import javafx.stage.Stage;
4: import javafx.scene.text.Font;
5: import javafx.scene.layout.VBox;
6: import javafx.scene.control.Button;
8: /**
9: Simple demonstration of adding buttons to a JavaFX application.
10: These buttons do not do anything. That comes in a later version.
11: */
12: public class PreliminaryButtonDemo extends Application
13: {
14: public static void main(String[] args)
15: {
16: launch(args);
17: }
19: @Override
20: public void start(Stage primaryStage) throws Exception
21: {
22: VBox root = new VBox();
23: Button btnSunny;
24: Button btnCloudy;
25: btnSunny = new Button("Sunny");
26: btnCloudy = new Button("Cloudy");
27: root.getChildren().add(btnSunny);
28: root.getChildren().add(btnCloudy);
30: Scene scene = new Scene(root, 300, 100);
31: primaryStage.setTitle("Button Demo");
32: primaryStage.setScene(scene);
33: primaryStage.show();
34: }
35: }