我正在开发一个应用程序,用于观察谁负责不同的患者,但是我还没有能够解决如何用不同的对象类型填充表.
下面是我的TableView控制器的代码.TableView最终会有四种不同的对象类型,所有这些都将从数据库中检索出来.
我希望我的表能够保存Patient对象,User对象(负责人)和RelationManager对象.
以下是我的代码,如果您需要更多代码,请告诉我:-).
package fird.presentation;
import fird.Patient;
import fird.RelationManager;
import fird.User;
import fird.data.DAOFactory;
import fird.data.DataDAO;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.ResourceBundle;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
/**
* FXML Controller class
*
* @author SimonKragh
*/
public class KMAMainFrameOverviewController implements Initializable {
@FXML
private TextField txtCPRKMAMainFrame;
@FXML
private TableColumn<Patient, String> TableColumnCPR;
@FXML
private TableColumn<Patient, String> TableColumnFirstname;
@FXML
private TableColumn<Patient, String> TableColumnSurname;
@FXML
private TableColumn<User, …Run Code Online (Sandbox Code Playgroud)