import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.text.Text; import javafx.stage.Stage; public class FXDemo extends Application { @Override public void start(Stage stage) { Text text = new Text("Hello World!"); text.setY(text.getFont().getSize()); Scene scene = new Scene(new Group(text)); stage.setTitle("Welcome to JavaFX!"); stage.setScene(scene); stage.sizeToScene(); stage.show(); } public static void main(String[] args) { launch(args); } }