public void init() { /* Image img1 = new Image(TermProjectMain.class.getResourceAsStream("bkash.png")); bkash.setImage(img1); Image img2 = new Image(TermProjectMain.class.getResourceAsStream("sure cash.png")); sureCash.setImage(img2); Image img3 = new Image(TermProjectMain.class.getResourceAsStream("dutch bangla.png")); DBBL.setImage(img3); Image img4 = new Image(TermProjectMain.class.getResourceAsStream("mastercard.png")); masterCard.setImage(img4); Image img5 = new Image(TermProjectMain.class.getResourceAsStream("visa.png")); visa.setImage(img5); */ // fromBoxList.setAll(options); // toBoxList.setAll(options); // fromComboBox.getItems().addAll(fromBoxList); c = new clientInfo(); fromComboBox.getItems().addAll(options); // toComboBox.getItems().addAll(toBoxList); toComboBox.getItems().addAll(options); fromComboBox.setVisibleRowCount(4); toComboBox.setVisibleRowCount(4); // the code fragment below ensures that no day before today is selected from the datePicker by // disabling the selecting option for those days and marking them in pink color final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() { @Override public DateCell call(final DatePicker datePicker) { return new DateCell() { @Override public void updateItem(LocalDate item, boolean empty) { super.updateItem(item, empty); if (item.isBefore(LocalDate.now())) { setDisable(true); setStyle("-fx-background-color: #ffc0cb;"); } } }; } }; datePick.setDayCellFactory(dayCellFactory); datePick.setEditable(false); final ToggleGroup group = new ToggleGroup(); ACradioButton.setToggleGroup(group); nonACradioButton.setToggleGroup(group); }
@FXML void fromComboBoxAction(ActionEvent event) { // fromComboBox.setItems(options); /* if(fromClicked && toClicked && !lastClicked.equals("from")){ fromBoxList.setAll(options); toBoxList.setAll(options); toClicked=false; System.out.println("both combo box has been clicked"); } */ /*System.out.println("now fromBoxList of size "+ fromBoxList.size()+ " will be setAll()"); fromComboBox.setItems(fromBoxList); */ // fromComboBox=new ComboBox(fromBoxList); String s = (String) fromComboBox.getValue(); c.setFrom(s); if (fromComboBox.getValue() == toComboBox.getValue()) { toComboBox .getSelectionModel() .clearSelection(); // to clear the selected option in the other combo box, because the // starting point and destination can't be the same c.setTo(null); // toComboBox.setButtonCell(null); // toComboBox.valueProperty().set(null); // toComboBox.getSelectionModel().clearSelection(); } // System.out.println(s.getClass()); // System.out.println(s); System.out.println("from " + s); // temp.remove(s); /* fromClicked=true; fromCombo=s; lastClicked="from"; //options.removeAll(s); if(fromClicked && !toClicked){ toBoxList.remove(fromCombo); System.out.println("removing "+fromCombo+" from the list and after removing, the size of the toBoxList= "+toBoxList.size()); toComboBox.setItems(toBoxList); } */ }