なぜダイアログを使用しようとしませんか?私はいくつかの時間前に同じ問題を持っていたと私はダイアログ
クラスを使用して、それを解決し を
Dialog dialogQtPrescription = new Dialog();
dialogQtPrescription.setTitle(bundle.getString("quantityPrescription.title"));
dialogQtPrescription.setHeaderText(bundle.getString("quantityPrescription.message"));
dialogQtPrescription.initModality(Modality.APPLICATION_MODAL);
dialogQtPrescription.initOwner(mainStage);
dialogQtPrescription.initStyle(StageStyle.UTILITY);
GridPane gridDialogPrescription = new GridPane();
gridDialogPrescription.setHgap(10);
gridDialogPrescription.setVgap(10);
gridDialogPrescription.add(new Label(bundle.getString("quantityPrescription.title")), 0, 0);
TextField txtQtPrescr = new TextField();
ButtonType buttonTypeNo = new ButtonType(bundle.getString("keepDefaultConfiguration.buttonNo"));
ButtonType buttonTypeYes = new ButtonType(bundle.getString("keepDefaultConfiguration.buttonYes"));
ButtonType buttonTypeCancel = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);
dialogQtPrescription.getDialogPane().getButtonTypes().addAll(buttonTypeNo,buttonTypeYes, buttonTypeCancel);
dialogQtPrescription.getDialogPane().lookupButton(buttonTypeYes).setDisable(true);
txtQtPrescr.setPrefWidth(100);
gridDialogPrescription.add(txtQtPrescr, 1, 0);
dialogQtPrescription.getDialogPane().setContent(gridDialogPrescription);
txtQtPrescr.setOnKeyTyped((KeyEvent ke) -> {
if(ke.getCharacter().matches("[0-9]")){
dialogQtPrescription.getDialogPane().lookupButton(buttonTypeYes).setDisable(false);
}else{
dialogQtPrescription.getDialogPane().lookupButton(buttonTypeYes).setDisable(true);
ke.consume();
}
});
Optional<ButtonType> result = dialogQtPrescription.showAndWait();
if (result.get() == buttonTypeYes){
String int_ext;
if(toggleInternal.isSelected()){
int_ext="I";
}else{
int_ext="E";
}
//masterData.remove(super.getIndex());
//add(new DataPick(um.getRECEIVER(),um.getID_ORDER(), um.getORDER_TYPE(),um.getUPDATE_TIME(),um.getTARGET_TIME(),ans.getID_POST(),ans.getPOST_TYPE(),ans.getREF(),Integer.parseInt(ans.getQUANTITY()),0,bundle.getString("dataPick.insert"),0));
//Add quantity --> filtro Numero
//DataPick(String receiver, String id_order, String order_type, String update_time, String target_time, String id_post, String post_type,String ref, int quantity, int quantity_delivered, String report, int quantity_available) {
if(Integer.parseInt(txtQtPrescr.getText())>0){
masterPrescription.add(new DataPick(txtPatientCode.getText(), txtPrescriptionCode.getText(), int_ext , txtUpdateTime.getText(), txtTargetTime.getText(),String.valueOf(masterPrescription.size()),"0",rmc.getRmc(),Integer.parseInt(txtQtPrescr.getText()),0,"feed back from Webservices",0, "", rmc.getProductNameRmc()+" "+rmc.getCodeEan()+" "+rmc.getCodeA()));
}else{
Platform.runLater(() -> {
Notification notification = new Notification("ERROR", bundle.getString("errorQuantity.question"), Notification.ERROR_ICON);
SmartDrawerTool.notifier.notify(notification);
});
}
}
ここに私がやったことの一例である私は、カスタムをしたいと思いますので、私はあなた
に役立つダイアログを考え使用して願っています親ノードから下にスライドするノード(この場合はTableView) –