问题描述
我有两个.fxml和两个Controller。
首先,显示来宾信息(蓝色),每当单击“添加”按钮时,它将弹出另一个阶段(灰色/白色)以搜索具有ICnumber的来宾。
我的计划当我完成搜索访客(灰色)时,我将单击“添加访客”按钮,阶段(灰色)将关闭,所有值都将传递到访客信息(蓝色)。
@FXML //Guest Information (blue stage)
void addGuest(ActionEvent event) throws IOException {
iclb.setText("ok"); //ignore this
Parent root = FXMLLoader.load(getClass().getResource("Guest.fxml"));
Scene scene = new Scene(root);
Stage stage = new Stage();
stage.setScene(scene);
stage.setTitle("Hotel System - Guest Information");
stage.setResizable(false);
stage.show();
}
public void addGuestInfo(String icno) {
iclb.setText(icno); // this is the label for IC Number
}
-
@FXML //Search Guest (grey stage)
void addGuest(ActionEvent event) throws IOException {
FXMLLoader loader = new FXMLLoader(getClass().getResource("MenuDraft.fxml"));
Parent root = loader.load();
MenuController menu = loader.getController();
menu.addGuestInfo(ictf.getText());
Stage stage = (Stage) addbt.getScene().getWindow();
stage.close();
}
到目前为止,我设法通过单击“添加访客”按钮来关闭访客,并能够关闭灰色阶段,但是这些值并未传递给访客信息(蓝色阶段)。
使用Javafx是我的新手吗?有人可以帮我吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)