Source of StackPaneDemo.java


  1: import javafx.application.Application;
  2: import javafx.scene.Scene;
  3: import javafx.stage.Stage;
  4: import javafx.scene.layout.StackPane;
  5: import javafx.scene.control.Label;
  6: import javafx.scene.text.Font;
  7: /**
  8: Simple demonstration of drawing two letters on top of each other
  9: using the StackPane layout.
 10: */
 11: public class StackPaneDemo 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:           StackPane root = new StackPane();
 22:           Label label1 = new Label("o");
 23:           label1.setFont(Font.font("Courier New", 54));
 24:           Label label2 = new Label("c");
 25:           label2.setFont(Font.font("Courier New", 24));
 26:           root.getChildren().add(label1);
 27:           root.getChildren().add(label2);
 28: 
 29:              Scene scene = new Scene(root, 300, 100);
 30:       primaryStage.setTitle("StackPane Demo");
 31:       primaryStage.setScene(scene);
 32:       primaryStage.show();
 33:    }
 34: }