小编Joh*_*ang的帖子

为什么我的 JavaFX TableView 是空的

我在 TableView 中添加了默认的 TEST1 和 TEST2 作为 Name Col,但运行时没有显示。这是我使用的两个类和一个 fxml,任何人都可以给我一些关于这个问题的建议吗?

只有一个包调用:controllerJBoxFXTest

第一类MainView.class包controllerJBoxFXTest;

import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

public class MainView extends Application {

    public static void main(String[] args){
        Application.launch(MainView.class, (java.lang.String[]) null);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        try {
            AnchorPane Page = (AnchorPane) FXMLLoader.load(MainView.class.getResource("MainController.fxml"));
            Scene scene = new Scene(Page);
            primaryStage.setScene(scene);
            primaryStage.setTitle("Test Main");
            primaryStage.show();
        } catch (Exception e){
            Logger.getLogger(MainView.class.getName()).log(Level.SEVERE, null, e);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

第2个MainController.java,可以看到我添加了TEST1和TEST2包controllerJBoxFXTest;

import java.net.URL;
import java.util.ResourceBundle; …
Run Code Online (Sandbox Code Playgroud)

java javafx javafx-2

1
推荐指数
1
解决办法
2987
查看次数

标签 统计

java ×1

javafx ×1

javafx-2 ×1