@Override public void onAnything() { Device oldDevice = deviceCombo.getValue(); if (oldDevice != null) { deviceCombo.setValue(deviceStore.findModel(oldDevice)); } else if (deviceStore.size() == 1) { deviceCombo.setValue(deviceStore.get(0)); } }
@RequestMapping(value = "/getComboxs") @ResponseBody @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true) public JSONArray getFuncMenuTops(@RequestParam("codetablename") String codetablename) { // System.out.println("-----------" + voName); // System.out.println("-----------" + code); // System.out.println("-----------" + name); List<OptionObject> cacheList = CacheService.getCachelist(codetablename); // System.out.println("=================" + cache.get(voName)); // System.out.println("=================" + // cache.get(voName).getObjectValue()); JSONArray arrays = new JSONArray(); if (cacheList != null && cacheList.size() > 0) { for (int i = 0; i < cacheList.size(); i++) { OptionObject optionObject = cacheList.get(i); ComboBox bo = new ComboBox(); bo.setKey(optionObject.getKey()); bo.setValue(optionObject.getValue()); bo.setKeyvalue(optionObject.getKeyvalue()); arrays.add(bo); } } // String jsonString = JSONValue.toJSONString(l1); // System.out.println("-----------" + arrays); return arrays; }
public void initProviders() throws DataBaseException { providers = dao.getProviders(); selectProviderCb.getItems().clear(); for (Provider provider : providers) { selectProviderCb.getItems().add(provider.getName()); } selectProviderCb.setValue(providers.get(0).getName()); }
public void open(File f) { Properties open = new Properties(); InputStream input = null; try { input = new FileInputStream(f); open.load(input); selectProviderCb.setValue(open.getProperty("provider")); selectGrainCb.setValue(open.getProperty("grain")); weightTf.setText(open.getProperty("weight")); infoTa.setText(open.getProperty("info")); for (Entry<String, TextField> entry : propertiesTf.entrySet()) { String propertyName = entry.getKey(); TextField tf = entry.getValue(); CheckBox cb = propertiesCb.get(propertyName); tf.setText(open.getProperty(propertyName)); if (open.getProperty(propertyName + "_ENABLED").equals("ON")) { tf.setDisable(false); cb.setSelected(true); } else { tf.setDisable(true); cb.setSelected(false); } } mainStage.setTitle(f.getName()); } catch (Exception ex) { infoTa.setText("Не могу открыть файл"); } finally { if (input != null) { try { input.close(); } catch (IOException e) { e.printStackTrace(); } } } }
public void newFile() { infoTa.setText(""); selectProviderCb.setValue(providers.get(0).getName()); weightTf.setText("0.0"); for (Entry<String, TextField> entry : propertiesTf.entrySet()) { String propertyName = entry.getKey(); TextField tf = entry.getValue(); CheckBox cb = propertiesCb.get(propertyName); tf.setText("0.0"); tf.setDisable(true); cb.setSelected(false); } file = null; mainStage.setTitle("unknown"); }
void displayVersions(String path) { List<PageVersion> pageVersions = pageService.getPageVersions(path); if (pageVersions.size() > 0) { final ComboBox pageSelection = new ComboBox(); content.addComponent(pageSelection); pageSelection.setNullSelectionAllowed(false); pageSelection.setStyleName("version-selection-box"); pageSelection.setTextInputAllowed(false); pageSelection.addValueChangeListener( new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { selectedVersion = (PageVersion) pageSelection.getValue(); if (selectedVersion != null) { Page page = pageService.getPageByVersion(beanItem.getPath(), selectedVersion.getName()); page.setPath(beanItem.getPath()); previewForm.setBean(page); previewLayout.setTitle(page.getSubject()); ((PagePreviewFormLayout) previewLayout).displayPageInfo(page); } } }); pageSelection.setItemCaptionMode(ItemCaptionMode.EXPLICIT); pageSelection.setNullSelectionAllowed(false); for (int i = 0; i < pageVersions.size(); i++) { PageVersion version = pageVersions.get(i); pageSelection.addItem(version); pageSelection.setItemCaption(version, getVersionDisplay(version, i)); } if (pageVersions.size() > 0) { pageSelection.setValue(pageVersions.get(pageVersions.size() - 1)); } } }
public void initGrains() { grains = new ArrayList<>(); grains.add(new Wheat()); grains.add(new Rice()); for (Grain grain : grains) { selectGrainCb.getItems().add(grain.getDescription()); } selectGrainCb .valueProperty() .addListener( new ChangeListener<String>() { @Override public void changed(ObservableValue ov, String t, String t1) { grain = getGrain(t1); initProperties(grain); } }); selectGrainCb.setValue(grains.get(0).getDescription()); }
public void edit(CrawlerResult crawlerResult) { this.crawlerResult = crawlerResult; if (crawlerResult != null) { coin = new Coin(); coin.setName(crawlerResult.getName()); coin.setNominal(NameUtils.parseNominal(crawlerResult.getName())); CoinVariant variant = new CoinVariant(); // variant.setReleaseDate(LocalDate.now()); variant.setVariant(NameUtils.parseVariant(crawlerResult.getVariant())); if (variant.getVariant() == Variant.UNKNOWN) { variant.setVariant(NameUtils.parseVariant(crawlerResult.getName())); } coin.addVariant(variant); variantField.setValue(variant.getVariant()); CoinVariantHistory history = new CoinVariantHistory(); history.setDate(crawlerResult.getProcessed()); history.setSource(crawlerResult.getSource().toString()); Money price = PriceUtils.parse(crawlerResult.getPrice()); if (price == null) { price = Money.euros(0.0); } history.setPrice(price); variant.addHistory(history); priceField.setValue(price.toString()); formFieldBindings = BeanFieldGroup.bindFieldsBuffered(coin, this); sourceLink.setCaption(LinkUtils.getSourceUrl(crawlerResult)); sourceLink.setResource(new ExternalResource(LinkUtils.getUrl(crawlerResult))); sourceLink.setTargetName("_blank"); name.focus(); } setVisible(crawlerResult != null); }
public void selectDevice(Device device) { deviceCombo.setValue(device, false); }
private void updateSelectedEntry() { ObservableList<PolizistDaten> Nutzerauswahl = Tabelle.getSelectionModel().getSelectedItems(); if (Nutzerauswahl.size() != 1) { IM.setErrorText("Es muss genau ein Element ausgewählt werden"); return; } PolizistDaten Auswahl = Nutzerauswahl.get(0); // Jetzt erzeugen wir ein PopUp zum veraendern des Eintrags Stage PopUp = new Stage(); PopUp.initModality(Modality.APPLICATION_MODAL); PopUp.setTitle("Neuer Eintrag"); PopUp.setAlwaysOnTop(true); PopUp.setResizable(false); GridPane Gitter = new GridPane(); Gitter.setHgap(10); Gitter.setVgap(10); Label LabelA = new Label("PersonenID"); Label LabelAWert = new Label(Integer.toString(Auswahl.getPersonenID())); Label LabelB = new Label("Name"); TextField LabelBWert = new TextField(); Label LabelC = new Label("Geburtsdatum"); DatePicker LabelCWert = new DatePicker(); Label LabelD = new Label("Nationalität"); TextField LabelDWert = new TextField(); Label LabelE = new Label("Geschlecht"); ComboBox LabelEWert = new ComboBox(); Label LabelF = new Label("Todesdatum"); DatePicker LabelFWert = new DatePicker(); Label LabelG = new Label("Dienstgrad"); TextField LabelGWert = new TextField(); final Callback<DatePicker, DateCell> TagesZellenFabtrik = new Callback<DatePicker, DateCell>() { @Override public DateCell call(final DatePicker DP) { return new DateCell() { @Override public void updateItem(LocalDate item, boolean empty) { super.updateItem(item, empty); if (item.isBefore(LabelCWert.getValue().plusDays(1))) { setDisable(true); setStyle("-fx-background-color: #ffc0cb;"); } } }; } }; LabelFWert.setDayCellFactory(TagesZellenFabtrik); LabelEWert.getItems().addAll("m", "w"); LabelEWert.setValue(Auswahl.getGeschlecht()); LabelBWert.setText(Auswahl.getName()); LabelCWert.setValue(LocalDate.parse(Auswahl.getGebDatum())); // TODO exception LabelDWert.setText(Auswahl.getNation()); if (!Auswahl.getTodDatum().isEmpty()) { LabelFWert.setValue(LocalDate.parse(Auswahl.getTodDatum())); // TODO exception } LabelGWert.setText(Auswahl.getDienstgrad()); Button ButtonFort = new Button("Fortfahren"); Button ButtonAbb = new Button("Abbrechen"); ButtonFort.defaultButtonProperty(); ButtonAbb.cancelButtonProperty(); ButtonFort.setMaxWidth(Double.MAX_VALUE); ButtonAbb.setMaxWidth(Double.MAX_VALUE); Gitter.addColumn(0, LabelA, LabelB, LabelC, LabelD, LabelE, LabelF, LabelG); Gitter.addColumn( 1, LabelAWert, LabelBWert, LabelCWert, LabelDWert, LabelEWert, LabelFWert, LabelGWert); VBox AussenBox = new VBox(10); HBox InnenBox = new HBox(); AussenBox.setSpacing(10); AussenBox.setPadding(new Insets(10)); InnenBox.setSpacing(10); AussenBox.setAlignment(Pos.CENTER); InnenBox.setAlignment(Pos.BOTTOM_CENTER); AussenBox.getChildren().addAll(Gitter, InnenBox); InnenBox.getChildren().addAll(ButtonFort, ButtonAbb); ButtonAbb.setOnAction(event -> PopUp.close()); ButtonFort.setOnAction( event -> { String SQLString; if (LabelFWert.getEditor().getText().isEmpty()) { SQLString = "UPDATE PERSON SET Name=?, Geburtsdatum=?, Nationalität=?, Geschlecht=?, Todesdatum=NULL WHERE PersonenID = " + Auswahl.getPersonenID(); } else { SQLString = "UPDATE PERSON SET Name=?, Geburtsdatum=?, Nationalität=?, Geschlecht=?, Todesdatum=? WHERE PersonenID = " + Auswahl.getPersonenID(); } try { PreparedStatement InsertStatement = DH.prepareStatement(SQLString); InsertStatement.setString(1, LabelBWert.getText()); InsertStatement.setString(2, LabelCWert.getValue().toString()); // TODO exception InsertStatement.setString(3, LabelDWert.getText()); InsertStatement.setString(4, LabelEWert.getValue().toString()); if (LabelFWert.getValue() != null && !LabelFWert.getEditor().getText().isEmpty()) { InsertStatement.setString(5, LabelFWert.getValue().toString()); } InsertStatement.executeUpdate(); SQLString = "UPDATE POLIZIST SET Dienstgrad = ? WHERE PersonenID = " + Auswahl.getPersonenID(); InsertStatement = DH.prepareStatement(SQLString); InsertStatement.setString(1, LabelGWert.getText()); InsertStatement.execute(); IM.setInfoText("Änderung durchgeführt"); } catch (SQLException e) { IM.setErrorText("Ändern Fehlgeschlagen", e); } refreshPolizistAnsicht(); PopUp.close(); }); PopUp.setScene(new Scene(AussenBox)); PopUp.showAndWait(); }
private void insertNewEntry() { Stage PopUp = new Stage(); PopUp.initModality(Modality.APPLICATION_MODAL); PopUp.setTitle("Neuer Eintrag"); PopUp.setAlwaysOnTop(true); PopUp.setResizable(false); GridPane Gitter = new GridPane(); Gitter.setHgap(10); Gitter.setVgap(10); Label LabelB = new Label("Name"); TextField LabelBWert = new TextField(); Label LabelC = new Label("Geburtsdatum"); DatePicker LabelCWert = new DatePicker(); Label LabelD = new Label("Nationalität"); TextField LabelDWert = new TextField(); Label LabelE = new Label("Geschlecht"); ComboBox LabelEWert = new ComboBox(); Label LabelF = new Label("Todesdatum"); DatePicker LabelFWert = new DatePicker(); Label LabelG = new Label("Dienstgrad"); TextField LabelGWert = new TextField(); final Callback<DatePicker, DateCell> TagesZellenFabtrik = new Callback<DatePicker, DateCell>() { @Override public DateCell call(final DatePicker DP) { return new DateCell() { @Override public void updateItem(LocalDate item, boolean empty) { super.updateItem(item, empty); if (item.isBefore(LabelCWert.getValue().plusDays(1))) { setDisable(true); setStyle("-fx-background-color: #ffc0cb;"); } } }; } }; LabelFWert.setDayCellFactory(TagesZellenFabtrik); LabelEWert.getItems().addAll("m", "w"); LabelEWert.setValue("m"); Button ButtonFort = new Button("Fortfahren"); Button ButtonAbb = new Button("Abbrechen"); ButtonFort.defaultButtonProperty(); ButtonAbb.cancelButtonProperty(); ButtonFort.setMaxWidth(Double.MAX_VALUE); ButtonAbb.setMaxWidth(Double.MAX_VALUE); Gitter.addColumn(0, LabelB, LabelC, LabelD, LabelE, LabelF, LabelG); Gitter.addColumn(1, LabelBWert, LabelCWert, LabelDWert, LabelEWert, LabelFWert, LabelGWert); VBox AussenBox = new VBox(10); HBox InnenBox = new HBox(); AussenBox.setSpacing(10); AussenBox.setPadding(new Insets(10)); InnenBox.setSpacing(10); AussenBox.setAlignment(Pos.CENTER); InnenBox.setAlignment(Pos.BOTTOM_CENTER); AussenBox.getChildren().addAll(Gitter, InnenBox); InnenBox.getChildren().addAll(ButtonFort, ButtonAbb); ButtonAbb.setOnAction(event -> PopUp.close()); ButtonFort.setOnAction( event -> { String SQLString; if (LabelFWert.getValue() != null) { SQLString = "INSERT INTO PERSON (Name, Geburtsdatum, Nationalität, Geschlecht, Todesdatum) VALUES (?, ?, ?, ?, ?)"; } else { SQLString = "INSERT INTO PERSON (Name, Geburtsdatum, Nationalität, Geschlecht) VALUES (?, ?, ?, ?)"; } try { PreparedStatement InsertStatement = DH.prepareStatement(SQLString); InsertStatement.setString(1, LabelBWert.getText()); InsertStatement.setString(2, LabelCWert.getValue().toString()); // TODO exception InsertStatement.setString(3, LabelDWert.getText()); InsertStatement.setString(4, LabelEWert.getValue().toString()); if (LabelFWert.getValue() != null) { InsertStatement.setString(5, LabelFWert.getValue().toString()); // TODO exception } InsertStatement.executeUpdate(); ResultSet PersID = DH.getAnfrageObjekt().executeQuery("SELECT last_insert_rowid();"); if (!PersID.next()) { IM.setErrorText("Konnte Primärschlüssel nicht mehr bestimmen."); } SQLString = "INSERT INTO POLIZIST (PersonenID, Dienstgrad) VALUES (?, ?)"; InsertStatement = DH.prepareStatement(SQLString); InsertStatement.setInt(1, PersID.getInt(1)); // TODO das hier verifizieren InsertStatement.setString(2, LabelGWert.getText()); InsertStatement.executeUpdate(); IM.setInfoText("Einfügen durchgeführt"); } catch (SQLException e) { IM.setErrorText("Einfügen Fehlgeschlagen", e); } refreshPolizistAnsicht(); PopUp.close(); }); PopUp.setScene(new Scene(AussenBox)); PopUp.showAndWait(); }
/** * Creates popup menu based on menu button selected * * @param type type of menu button selected */ @SuppressWarnings({"unchecked", "rawtypes"}) private void genericPopup(String type) { int length = 0; int width = 0; String title = new String(); Stage secondaryStage = new Stage(); // Create a GridPane container GridPane grid = new GridPane(); grid.setPadding(new Insets(10, 10, 10, 10)); grid.setVgap(5); grid.setHgap(5); Button submit = new Button("Submit"); GridPane.setConstraints(submit, 1, 0); grid.getChildren().add(submit); if (type.equals("customer")) { final TextField name = new TextField(); name.setPrefColumnCount(17); GridPane.setConstraints(name, 0, 0); grid.getChildren().add(name); submit.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { if (!name.getText().isEmpty()) { if (myController.getRestClient().selectCustomer(name.getText(), name)) { secondaryStage.close(); } } else { name.setPromptText("Enter customer username."); } updateAccountsWindow(); } }); length = 50; width = 285; title = "Select Customer"; } else if (type.equals("create")) { final ComboBox accountTypeCB = new ComboBox(); accountTypeCB .getItems() .addAll("SELECT TYPE", "CHECKING", "SAVINGS", "MONEY MARKET", "MORTGAGE", "CREDIT"); accountTypeCB.setValue("SELECT TYPE"); GridPane.setConstraints(accountTypeCB, 0, 0); grid.getChildren().add(accountTypeCB); submit.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { if (accountTypeCB.getValue().toString().equals("SELECT TYPE")) { accountTypeCB.setValue("SELECT TYPE"); } else { Account.TYPE thisType = Account.TYPE.CHECKING; if (accountTypeCB.getValue().toString().equals("SAVINGS")) { thisType = Account.TYPE.SAVINGS; } else if (accountTypeCB.getValue().toString().equals("MONEY MARKET")) { thisType = Account.TYPE.MONEY_MARKET; } else if (accountTypeCB.getValue().toString().equals("MORTGAGE")) { thisType = Account.TYPE.MORTGAGE; } else if (accountTypeCB.getValue().toString().equals("CREDIT")) { thisType = Account.TYPE.CREDIT; } if (myController.getRestClient().addAccount(thisType, 0.0f, 0.0f)) { secondaryStage.close(); } else { accountTypeCB.setValue("SELECT TYPE"); } } updateAccountsWindow(); } }); length = 50; width = 285; title = "Create Account"; } else if (type.equals("delete")) { final ComboBox accountsCB = new ComboBox(); if (myController.getRestClient().getUserAccounts() != null) { Iterator it = myController.getRestClient().getUserAccounts().entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry) it.next(); accountsCB.getItems().add(me.getKey()); } } accountsCB.setValue("SELECT ACCOUNT"); GridPane.setConstraints(accountsCB, 0, 0); grid.getChildren().add(accountsCB); submit.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { if (accountsCB.getValue().equals("SELECT ACCOUNT")) { accountsCB.setValue("SELECT ACCOUNT"); } else { if (myController.getRestClient().deleteAccount((int) accountsCB.getValue())) { secondaryStage.close(); } else { accountsCB.setValue("SELECT ACCOUNT"); } } updateAccountsWindow(); } }); length = 50; width = 285; title = "Delete Account"; } else if (type.equals("deposit")) { final ComboBox accountsCB = new ComboBox(); final TextField amount = new TextField(); amount.setPrefColumnCount(10); amount.setPromptText("Deposit Amount"); if (myController.getRestClient().getUserAccounts() != null) { Iterator it = myController.getRestClient().getUserAccounts().entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry) it.next(); accountsCB.getItems().add(me.getKey()); } } accountsCB.setValue("SELECT ACCOUNT"); GridPane.setConstraints(accountsCB, 0, 0); grid.getChildren().add(accountsCB); GridPane.setConstraints(amount, 0, 1); grid.getChildren().add(amount); submit.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { if (accountsCB.getValue().equals("SELECT ACCOUNT")) { accountsCB.setValue("SELECT ACCOUNT"); } else if (!accountsCB.getValue().equals("SELECT ACCOUNT") && !amount.getText().isEmpty()) { if (myController .getRestClient() .makeDeposit((int) accountsCB.getValue(), Float.valueOf(amount.getText()))) { secondaryStage.close(); } else { accountsCB.setValue("SELECT ACCOUNT"); amount.setPromptText("Deposit Amount"); } } else { accountsCB.setValue("SELECT ACCOUNT"); amount.setPromptText("Deposit Amount"); } updateAccountsWindow(); } }); length = 100; width = 285; title = "Make Deposit"; } else if (type.equals("withdraw")) { final ComboBox accountsCB = new ComboBox(); final TextField amount = new TextField(); amount.setPrefColumnCount(10); amount.setPromptText("Withdraw Amount"); if (myController.getRestClient().getUserAccounts() != null) { Iterator it = myController.getRestClient().getUserAccounts().entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry) it.next(); accountsCB.getItems().add(me.getKey()); } } accountsCB.setValue("SELECT ACCOUNT"); GridPane.setConstraints(accountsCB, 0, 0); grid.getChildren().add(accountsCB); GridPane.setConstraints(amount, 0, 1); grid.getChildren().add(amount); submit.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { if (accountsCB.getValue().equals("SELECT ACCOUNT")) { accountsCB.setValue("SELECT ACCOUNT"); } else if (!accountsCB.getValue().equals("SELECT ACCOUNT") && !amount.getText().isEmpty()) { if (myController .getRestClient() .makeWithdrawal((int) accountsCB.getValue(), Float.valueOf(amount.getText()))) { secondaryStage.close(); } else { accountsCB.setValue("SELECT ACCOUNT"); amount.setPromptText("Withdraw Amount"); } } else { accountsCB.setValue("SELECT ACCOUNT"); amount.setPromptText("Withdraw Amount"); } updateAccountsWindow(); } }); length = 100; width = 285; title = "Make Deposit"; } else if (type.equals("transfer")) { final ComboBox srcAccountsCB = new ComboBox(); final ComboBox dstAccountsCB = new ComboBox(); final TextField amount = new TextField(); amount.setPrefColumnCount(10); amount.setPromptText("Transfer Amount"); if (myController.getRestClient().getUserAccounts() != null) { Iterator it = myController.getRestClient().getUserAccounts().entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry) it.next(); srcAccountsCB.getItems().add(me.getKey()); dstAccountsCB.getItems().add(me.getKey()); } } srcAccountsCB.setValue("SELECT FROM ACCOUNT"); dstAccountsCB.setValue("SELECT TO ACCOUNT"); GridPane.setConstraints(srcAccountsCB, 0, 0); GridPane.setConstraints(srcAccountsCB, 0, 1); GridPane.setConstraints(amount, 0, 2); grid.getChildren().add(srcAccountsCB); grid.getChildren().add(dstAccountsCB); grid.getChildren().add(amount); submit.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { if (srcAccountsCB.getValue().equals("SELECT FROM ACCOUNT")) { srcAccountsCB.setValue("SELECT FROM ACCOUNT"); } else if (dstAccountsCB.getValue().equals("SELECT TO ACCOUNT")) { dstAccountsCB.setValue("SELECT TO ACCOUNT"); } else if (!srcAccountsCB.getValue().equals("SELECT FROM ACCOUNT") && !dstAccountsCB.getValue().equals("SELECT TO ACCOUNT") && !amount.getText().isEmpty()) { if (myController .getRestClient() .makeTransfer( (int) srcAccountsCB.getValue(), (int) dstAccountsCB.getValue(), Float.valueOf(amount.getText()))) { secondaryStage.close(); } else { srcAccountsCB.setValue("SELECT FROM ACCOUNT"); dstAccountsCB.setValue("SELECT TO ACCOUNT"); amount.setPromptText("Transfer Amount"); } } else { srcAccountsCB.setValue("SELECT FROM ACCOUNT"); dstAccountsCB.setValue("SELECT TO ACCOUNT"); amount.setPromptText("Transfer Amount"); } updateAccountsWindow(); } }); length = 125; width = 285; title = "Transfer Funds"; } else if (type.equals("transaction")) { final ComboBox accountsCB = new ComboBox(); if (myController.getRestClient().getUserAccounts() != null) { Iterator it = myController.getRestClient().getUserAccounts().entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry) it.next(); accountsCB.getItems().add(me.getKey()); } } accountsCB.setValue("SELECT ACCOUNT"); GridPane.setConstraints(accountsCB, 0, 0); grid.getChildren().add(accountsCB); submit.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { if (accountsCB.getValue().equals("SELECT ACCOUNT")) { accountsCB.setValue("SELECT ACCOUNT"); } else if (!accountsCB.getValue().equals("SELECT ACCOUNT")) { if (myController.getRestClient().getUserAccounts() != null) { Iterator it = myController.getRestClient().getUserAccounts().entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry) it.next(); if (accountsCB.getSelectionModel().getSelectedItem() == me.getKey()) { updateTransactionWindow((Account) me.getValue()); } } secondaryStage.close(); } else { accountsCB.setValue("SELECT ACCOUNT"); } } else { accountsCB.setValue("SELECT ACCOUNT"); } updateAccountsWindow(); } }); length = 100; width = 285; title = "View Transactions"; } Scene scene = new Scene(grid, width, length); secondaryStage.setScene(scene); secondaryStage.setTitle(title); secondaryStage.show(); }