首页javatextJavaFX - 如何import javafx.application.Application ;.

JavaFX - 如何import javafx.application.Application ;.

我们想知道如何import javafx.application.Application ;.
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class Main extends Application {
  public static void main(String[] args) {
    Application.launch(args);
  }

  @Override
  public void start(Stage primaryStage) {
    primaryStage.setTitle("Text Fonts");

    Group g = new Group();
    Scene scene = new Scene(g, 550, 250);

    Text text1 = new Text();
    text1.setText("Hello World!");
    text1.setX(50);
    text1.setY(50);
    text1.setFill(Color.RED);

    g.getChildren().add(text1);

    primaryStage.setScene(scene);
    primaryStage.show();
  }
}