我在该特定控制器中有一个tableView,我想用传递的参数值初始化.问题是,在控制器将参数设置为变量之前,正在执行initialize方法.任何建议都会很棒.
我只是为了清楚地提到Location参数.
这是控制器的调用方法:
protected static void openReservationNewDialog(Location loc){
try{
FXMLLoader loader = new FXMLLoader();
loader.setLocation(viewLogic.class.getResource("openNewReservations.fxml"));
AnchorPane page = (AnchorPane) loader.load();
Stage dialogStage = new Stage();
dialogStage.setTitle("New Reservation");
dialogStage.setResizable(false);
Scene scene = new Scene(page);
dialogStage.setScene(scene);
openReservationNewDialogController controller=loader.getController();
controller.setDialogStage(dialogStage);
controller.setSelectedLocation(loc);
dialogStage.showAndWait();
} catch(Exception e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
这是相关的控制器部分:
public class openReservationNewDialogController implements Initializable{
@FXML
private TextField reservationId;
/**Reservation's member*/
@FXML
private ComboBox<String> member=new ComboBox<String>();
@FXML
private ComboBox<String> sMinutes= new ComboBox<String>();
@FXML
private ComboBox<String> eMinutes= new ComboBox<String>();
@FXML
private ComboBox<String> sHours= new ComboBox<String>(); …Run Code Online (Sandbox Code Playgroud)