title: Why are the buttons not showing up in the frame?
body: <p>I'm making a simple program to switch scenes in JavaFX. I created my button objects, added them to the layout, added the layout to the scene, but for some reason the buttons aren't showing up at all. The label shows up. Here's my code:</p>
  
  <pre><code>package switching.scenes;
  
  import javafx.application.Application;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.scene.control.Label;
  import javafx.scene.layout.VBox;
  import javafx.stage.Stage;
  
  public class SwitchingScenes extends Application {
  
  private Scene scene1, scene2, scene3;
  private Button button1, button2, button3;
  private Label label1, label2, label3;
  private VBox layout1, layout2, layout3;
  private Stage frame;
  
  @Override
  public void start(Stage primaryStage) {
  
      frame = primaryStage;
  
      // Create buttons
      button1 = new Button("Go to scene 1");
      button2 = new Button("Go to scene 2");
      button3 = new Button("Go to scene 3");
  
      // Button action listener
      button1.setOnAction(e -&gt; frame.setScene(scene1));
      button2.setOnAction(e -&gt; frame.setScene(scene2));
      button3.setOnAction(e -&gt; frame.setScene(scene3));
  
      // Create labels
      label1 = new Label("You are at scene 1");
      label2 = new Label("You are at scene 2");
      label3 = new Label("You are at scene 3");
  
      // Create layouts
      layout1 = new VBox(20);
      layout2 = new VBox(20);
      layout3 = new VBox(20);
  
      // Add elements to each layout
      layout1.getChildren().addAll(label1, button2, button3);
      layout2.getChildren().addAll(label2, button1, button3);
      layout3.getChildren().addAll(label3, button1, button2);
  
      // Create scenes
      scene1 = new Scene(layout1, 400,400);
      scene2 = new Scene(layout2, 400,400);
      scene3 = new Scene(layout3, 400,400);
  
      frame.setScene(scene1);
      frame.setTitle("Title");
      frame.show();
  }
  
  public static void main(String[] args) {
      launch(args);
  }
  
   }
  </code></pre>