当我右键单击 FXML 文档并单击使用场景构建器打开时,场景构建器会在我的任务栏上打开,但是如果我单击它,它不会显示任何内容,任何人都可以帮助我吗?
package application;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
try {
Parent root = FXMLLoader.load(getClass().getResource(
"/application/MyView.fxml"));
Scene scene = new Scene(root);
scene.getStylesheets().add(
getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
setUserAgentStylesheet(STYLESHEET_CASPIAN);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}
这是我的主要类(class)
最佳答案
我发现这是一个错误,您必须从桌面打开 Scene Builder 并且:
关于javafx-2 - 场景生成器打不开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25255328/