這裏是一個工作示例:
public void start(Stage stage) throws ClassNotFoundException, SQLException {
Class.forName("com.mysql.jdbc.Driver");
Scene scene =new Scene(new Group(),800,600);
JdbcDataSource dataSource=new JdbcDataSource("jdbc:mysql://localhost:3306/mybasename?zeroDateTimeBehavior=convertToNull&user=username&password=userpassword", "clients", "descr");
TableView tableView=new TableView();
tableView.setItems(dataSource.getData());
tableView.getColumns().addAll(dataSource.getColumns());
((Group)scene.getRoot()).getChildren().add(tableView);
stage.setScene(scene);
stage.show();
}
什麼是你的代碼的問題? – gontard