A JavaFX Application with a Scene Having a Text Node - Java JavaFX

Java examples for JavaFX:Scene

Description

A JavaFX Application with a Scene Having a Text Node

Demo Code

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class Main extends Application {
  public static void main(String[] args) {
    Application.launch(args);/* ww  w . jav  a 2  s  .c  o m*/
  }

  @Override
  public void start(Stage stage) {
    Text msg = new Text("Hello JavaFX");
    VBox root = new VBox();
    root.getChildren().add(msg);

    Scene scene = new Scene(root, 300, 50);
    stage.setScene(scene);
    stage.setTitle("Hello JavaFX Application");
    stage.show();
  }
}

Related Tutorials