Source of HBoxDemo.java


  1: import javafx.application.Application;
  2: import javafx.scene.Scene;
  3: import javafx.stage.Stage;
  4: import javafx.scene.layout.HBox;
  5: import javafx.scene.control.Button;
  6: 
  7: /**
  8: Simple demonstration of adding buttons using the HBox layout.
  9: These buttons do not do anything. That comes in a later version.
 10: */
 11: public class HBoxDemo extends Application
 12: {
 13:    public static void main(String[] args)
 14:    {
 15:       launch(args);
 16:    }
 17: 
 18:    @Override
 19:    public void start(Stage primaryStage) throws Exception
 20:    {
 21:           HBox root = new HBox();
 22:           root.getChildren().add(new Button("This is Button 1"));
 23:           root.getChildren().add(new Button("This is Button 2"));
 24:           root.getChildren().add(new Button("This is Button 3"));
 25: 
 26:              Scene scene = new Scene(root, 250, 100);
 27:       primaryStage.setTitle("HBox Demo");
 28:       primaryStage.setScene(scene);
 29:       primaryStage.show();
 30:    }
 31: }