无法在intelij中运行Javafx应用程序

时间:2019-04-12 22:30:49

标签: java javafx

嗨,我开始了JavaFx课程,我从课程中复制了代码以自行尝试,但我感到惊讶的是,所有内容都无法正常工作。最初intelij没有识别任何JavaFx软件包,因此我在此https://openjfx.io/openjfx-docs/的指导下添加了它。仍然没有出现。 有代码:

package sample;

import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;

public class Main extends Application {
private Label myLabel;

private TextField nameTextField;


public void start(Stage primaryStage) throws Exception{
    primaryStage.setTitle("Hello JavaFX");

    Button button = new Button();
    button.setText("Click Me!");

    myLabel = new Label();
    nameTextField = new TextField();

    myLabel.setText("This is my label");

    FlowPane flowPaneRoot = new FlowPane(10, 10);
    flowPaneRoot.setAlignment(Pos.CENTER);



    flowPaneRoot.getChildren().add(button);
    flowPaneRoot.getChildren().add(myLabel);

    Scene scene =
            new Scene(flowPaneRoot, 250, 200);
    primaryStage.setScene(scene);
    primaryStage.show();

}

public static void main(String[] args) {
    launch(args);
 }
}

我收到错误列表: https://pastebin.com/s44d61zE

0 个答案:

没有答案
相关问题