Я скачал JavaFX Scene Builder 2.0, затем я создал новый проект JavaFX в Eclipse.
К сожалению, эта ошибка возникает:
Не удается разрешить импорт Javafx
Ниже журнала:
Eclipse version : 2019-09
JDK version : 13
Problem Description
Application cannot be resolved to a type
BorderPane cannot be resolved to a type
BorderPane cannot be resolved to a type
Scene cannot be resolved to a type
Scene cannot be resolved to a type
Stage cannot be resolved to a type
The import javafx cannot be resolved
The import javafx cannot be resolved
The import javafx cannot be resolved
The import javafx cannot be resolved
The method launch(String[]) is undefined for the type Main
Warnings
Build path specifies execution environment JavaSE-12. There are no JREs installed in the workspace that are strictly compatible with this environment. hello Build path JRE System Library Problem
Console
Error: Unable to initialize main class application.Main
Caused by: java.lang.NoClassDefFoundError: Stage
IВы уже скачали e (fx) clipse 3.6.0
package application;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
try{
BorderPane root = new BorderPane();
Scene scene = new Scene(root,400,400);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}