Source of ButtonInPane.java


  1: 
  2: import javafx.application.Application;
  3: import javafx.scene.Scene;
  4: import javafx.scene.control.Button;
  5: import javafx.scene.layout.StackPane;
  6: import javafx.stage.Stage;
  7: 
  8: public class ButtonInPane extends Application {
  9:   @Override // Override the start method in the Application class
 10:   public void start(Stage primaryStage) {
 11:     // Create a scene and place a button in the scene
 12:     StackPane pane = new StackPane();
 13:     pane.getChildren().add(new Button("OK"));
 14:     Scene scene = new Scene(pane, 200, 50);
 15:     primaryStage.setTitle("Button in a pane"); // Set the stage title
 16:     primaryStage.setScene(scene); // Place the scene in the stage
 17:     primaryStage.show(); // Display the stage
 18:   }
 19: 
 20:   /**
 21:    * The main method is only needed for the IDE with limited
 22:    * JavaFX support. Not needed for running from the command line.
 23:    */
 24:   public static void main(String[] args) {
 25:     launch(args);
 26:   }
 27: }