@FXML private void goToOverview(ActionEvent event) { RegName.clear(); RegPass.clear(); InvalidLabel.setText(""); main.setScreen(App.HotelOverviewID); }
/** Handle the KeyEvent when ENTER is pressed in TextInput */ private void handleInput() { upPressed = false; String input; String response; input = textInput.getText(); cmdHistory.addCommand(input); try { if (input.equals(COMMAND_HELP)) { mainApp.switchToHelp(); textInput.clear(); return; } logicOut = TaskieLogic.getInstance().execute(input); // logicOut can never be null as returned by Logic assert !(logicOut == null); // main list can never be empty as the first element is always a description of the content in // the list assert !(logicOut.getMain().isEmpty()); populate(logicOut.getMain(), logicOut.getAll()); response = logicOut.getFeedback(); feedbackLabel.setText(response); textInput.clear(); } catch (UnrecognisedCommandException e) { logger.log(Level.FINE, "invalid command at input", e); feedbackLabel.setText(INVALID_COMMAND_MESSAGE); } }
private void clearTabGezinInvoer() { // todo opgave 3 cbOuder1Invoer.getSelectionModel().clearSelection(); cbOuder2Invoer.getSelectionModel().clearSelection(); tfHuwelijkInvoer.clear(); tfScheidingInvoer.clear(); }
// Kui vajutad "Lisa", siis lisab järgnevad asjad public void lisaButtonVajutatud() { Kodut66.Input input = new Kodut66.Input(); input.setAine(aineInput.getText()); input.setRuum(Integer.parseInt(ruumInput.getText())); input.setDate(dateInput.getText()); table.getItems().add(input); aineInput.clear(); ruumInput.clear(); dateInput.clear(); }
private boolean validateInputs() { details = txtDetails.getText(); value = Double.parseDouble(txtValue.getText()); date = dpDate.getValue().toString(); txtDetails.clear(); txtValue.clear(); return true; }
private void clearTabGezin() { // todo opgave 3 cbGezinnen.getSelectionModel().clearSelection(); tfGezinNr.clear(); tfOuder1.clear(); tfOuder2.clear(); tfHuwelijk.clear(); tfScheiding.clear(); lvKinderen.setItems(FXCollections.emptyObservableList()); }
/** Shortcut down key for go to next key-in command */ private void downKeyEvent() { if (poppedCommands.isEmpty()) { txtCommandInput.clear(); } else { txtCommandInput.clear(); String pastCommand = poppedCommands.pop(); pastCommands.push(pastCommand); txtCommandInput.setText(pastCommand); } }
private void clearTabPersoonInvoer() { // todo opgave 3 tfVoornamenInvoer.clear(); tfTussenvoegselInvoer.clear(); tfAchternaamInvoer.clear(); cbGeslachtInvoer.getSelectionModel().clearSelection(); tfGeboortedatumInvoer.clear(); tfGeboorteplaatsInvoer.clear(); cbOuderlijkGezinInvoer.getSelectionModel().clearSelection(); }
private void clearFields() { first.clear(); last.clear(); businessName.clear(); address.clear(); city.clear(); state.clear(); zip.clear(); phone.clear(); email.clear(); fax.clear(); }
// cadastrando produtos em uma arrayList public void cadastraProduto(ActionEvent event) { Produto p = new Produto(); p.setNomeProduto(nomeP.getText()); p.setPrecoProduto(precoP.getText()); p.setValidadeProduto(validadeP.getText()); p.setFornecedorProduto(fornecedorP.getText()); prod.add(p); nomeP.clear(); precoP.clear(); validadeP.clear(); fornecedorP.clear(); }
@FXML protected void handleSubmitAction(ActionEvent event) throws IOException { String id = userIdField.getText(); String password = passwordField.getText(); RuleSet loginRules = RuleSetFactory.getRuleSet(this); ControllerInterface controller = SystemController.getInstance(); try { loginRules.applyRules(this); controller.login(id, password); Auth auth = SystemController.currentAuth; String fxmlFile = ""; switch (auth) { case ADMIN: fxmlFile = "../Admin.fxml"; break; case LIBRARIAN: fxmlFile = "../Librarian.fxml"; break; case BOTH: fxmlFile = "../MainMenu.fxml"; break; } Pane mainMenuRoot = FXMLLoader.load(getClass().getResource(fxmlFile)); Stage stage = new Stage(); stage.initModality(Modality.WINDOW_MODAL); stage.setTitle("Main Menu"); stage.setScene(new Scene(mainMenuRoot)); stage.show(); userIdField.clear(); passwordField.clear(); Stage loginStage = (Stage) submit.getScene().getWindow(); loginStage.close(); } catch (RuleException e1) { Alert alert = new Alert(AlertType.ERROR); alert.setTitle("Login Error!"); alert.setHeaderText("Incorrect login information!"); alert.setContentText(e1.getMessage()); alert.show(); } catch (LoginException e) { Alert alert = new Alert(AlertType.ERROR); alert.setTitle("Login Error!"); alert.setHeaderText("Incorrect login information!"); alert.setContentText(e.getMessage()); alert.show(); } }
@FXML private void handleRegistrationAction(ActionEvent event) throws IOException { if (RegName.getText().equals("") || RegPass.getText().equals("")) { RegName.clear(); RegPass.clear(); InvalidLabel.setText("Username or Password field cannot be empty"); } else { String Username = RegName.getText(); String Password = RegPass.getText(); SQLiteJDBC.InsertUser(Username, Password); RegName.clear(); RegPass.clear(); InvalidLabel.setText(""); main.setScreen(App.HotelOverviewID); } }
/** Action taken on button click Continue. Creates a player or displays an error. */ @FXML public final void confirmChoices() { if (textName.getText().isEmpty()) { lblWarning.setText("Please enter a name."); } else { if (playerCount > 0) { // Gets the currently picked color final String pickedColor = cmbColor.getValue(); // Create new player final Player tempPlayer = new Player(textName.getText(), cmbRace.getValue(), cmbColor.getValue()); main.addPlayer(tempPlayer); // Add new player // Remove picked Color from list cmbColor.getItems().remove(pickedColor); // Sets combo boxes back to zero index cmbColor.getSelectionModel().select(0); cmbRace.getSelectionModel().select(0); textName.clear(); lblWarning.setText(""); playerCount--; // Decrement player count after creation playerNum++; // Increment player Label number lblPlayerNum.setText("Player " + playerNum + ": Choose Your Options"); } else { // If just one player, and end case for last player final Player tempPlayer = new Player(textName.getText(), cmbRace.getValue(), cmbColor.getValue()); main.addPlayer(tempPlayer); // Display the map Screen to start game main.showMapScreen(); } } }
private void clearTextFields() { tfInfoId.clear(); tfInfoPos.clear(); tfInfoName.clear(); tfInfoStreet.clear(); tfInfoCSZ.clear(); tfInfoPayRate.clear(); tfHours.clear(); lblEditConfirm.setText(""); lblWageError.setVisible(false); }
public void clearText() { usernameText.clear(); passwordText.clear(); nameText.clear(); lastNameText.clear(); addressText.clear(); ageText.clear(); }
private void clearTabPersoon() { cbPersonen.getSelectionModel().clearSelection(); tfPersoonNr.clear(); tfVoornamen.clear(); tfTussenvoegsel.clear(); tfAchternaam.clear(); tfGeslacht.clear(); tfGebDatum.clear(); tfGebPlaats.clear(); cbOuderlijkGezin.getSelectionModel().clearSelection(); lvAlsOuderBetrokkenBij.setItems(FXCollections.emptyObservableList()); }
public void Login() throws IOException { // TODO set username og password til en string istedet for at hent dem på den måde // if username field is empty = error message if (usernameText.getText().equals("")) { passwordErrorLbl.setVisible(false); usernameErrorLbl.setVisible(true); loginErrorLbl.setVisible(false); } // if passwordfield is empty = error message if (passwordText.getText().equals("")) { usernameErrorLbl.setVisible(false); passwordErrorLbl.setVisible(true); loginErrorLbl.setVisible(false); } if (passwordText.getText().equals("") && usernameText.getText().equals("")) { usernameErrorLbl.setVisible(true); passwordErrorLbl.setVisible(true); loginErrorLbl.setVisible(false); } if (logic.userAuth(usernameText.getText(), passwordText.getText())) { usernameErrorLbl.setVisible(false); passwordErrorLbl.setVisible(false); loginErrorLbl.setVisible(false); usernameText.clear(); passwordText.clear(); // TODO get menu to display currentuser myController.setScreen(Main.screenMenuID); } else { usernameErrorLbl.setVisible(false); passwordErrorLbl.setVisible(false); loginErrorLbl.setVisible(true); } }
@FXML void deleteAction(ActionEvent event) { // reset Eingabfelder titelField.clear(); beschreibungTextField.clear(); kategorieComboBox.getSelectionModel().clearSelection(); messageField.setText("Felder gelöscht"); // reset Kalender vonDatePicker.setValue(null); bisDatePicker.setValue(null); return; }
@FXML public void handleFromKey(KeyEvent evt) { /* String character = evt.getCharacter(); if(!character.equals("1")) { //JOptionPane.showMessageDialog(null,evt.getCharacter()); System.out.println("You typed " + evt.getCharacter()); evt.consume(); } */ KeyCode code = evt.getCode(); System.out.println("Code " + code); /* if (KeyCode.DELETE == code) System.out.println("Del"); char ar[] = evt.getCharacter().toCharArray(); char ch = ar[evt.getCharacter().toCharArray().length - 1]; System.out.println("You entered " + String.valueOf(ar)); if (!(ch >= '0' && ch <= '9') && */ if (!(code.isDigitKey()) && !(KeyCode.BACK_SPACE.equals(code) || KeyCode.DELETE == code)) { System.out.println("The char you entered is not a number"); evt.consume(); } else { final String text = ((TextField) evt.getSource()).getText(); System.out.println("You entered " + text); /* Measurement from = AbstractMeasurement.of(new BigDecimal(text), fromCombo.getValue()); System.out.println("From " + from); Measurement to = from.to(toCombo.getValue()); System.out.println("To " + to);*/ if (fromCombo != null && fromCombo.getValue() != null && toCombo != null && toCombo.getValue() != null) { UnitConverter converter = fromCombo.getValue().getConverterTo(toCombo.getValue()); if (text != null && !text.isEmpty()) { Number convertedValue = converter.convert(Double.valueOf(text)); System.out.println("Converted: " + convertedValue); toFld.setText(FORMAT.format(convertedValue)); } else if (toFld.getText() != null && !toFld.getText().isEmpty()) { toFld.clear(); } } } }
@FXML protected void handleSubmitButtonAction(ActionEvent event) { db.Connect(); boolean test = db.userExist(username.getText().toString()); if (test) { System.out.println("User Exists"); test = db.checkPassword(username.getText().toString(), password.getText().toString()); if (test) { // if username and password is correct program moves to main screen System.out.println("Password is correct"); myController.setScreen(WellCheck.screenID2); db.patientTable(); } } username.clear(); password.clear(); System.out.println(username.getText().toString()); }
public void procesarNuevaMateria() { validarCampos(); nuevaMateria = new ConfirmarMaterial(); if (nuevaMateria.confirmarNuevaMateria(campoNuevaMateria.getText())) { consulta.registrarUnicoValor(4, campoNuevaMateria.getText().trim()); if (consulta.getMensaje() != null) { Utilidades.mensajeAdvertencia( null, consulta.getMensaje(), "Error al tratar de registrar la materia", "Error Registrar Materia"); } else { Utilidades.mensaje( null, "Materia registrada correctamente", "Registrando Materia", "Registro Exitoso"); campoNuevaMateria.clear(); } } }
public static void nupuvajutus(Button sorteeriNupp, TextField kasutajaInput) { // "Sorteeri!" nupp ACTION! Pane sobivKonteinerLayout = new Pane(); sorteeriNupp.setOnAction( event -> { voimalikPrygiList.getPrygi().clear(); sobivKonteinerLayout.getChildren().clear(); String input = kasutajaInput.getText().toLowerCase(); String sobivKonteiner = ""; if (input.isEmpty()) { sobivKonteiner = "Unustasid pürgi sisestada!"; } else if (TopView.bio.kuhuVisata(input) != "") { sobivKonteiner = TopView.bio.kuhuVisata(input); } else if (TopView.elektroonika.kuhuVisata(input) != "") { sobivKonteiner = TopView.elektroonika.kuhuVisata(input); } else if (TopView.paberPapp.kuhuVisata(input) != "") { sobivKonteiner = TopView.paberPapp.kuhuVisata(input); } else if (TopView.ohtlikud.kuhuVisata(input) != "") { sobivKonteiner = TopView.ohtlikud.kuhuVisata(input); } else if (TopView.metallpakend.kuhuVisata(input) != "") { sobivKonteiner = TopView.metallpakend.kuhuVisata(input); } else if (TopView.klaaspakend.kuhuVisata(input) != "") { sobivKonteiner = TopView.klaaspakend.kuhuVisata(input); } else if (TopView.plastpakend.kuhuVisata(input) != "") { sobivKonteiner = TopView.plastpakend.kuhuVisata(input); } else if (voimalikPrygiList.getPrygi().isEmpty()) { sobivKonteiner = "Kahjuks ei leidnud hetkel sobivat konteinerit, vaata äkki leiad midagi sarnast pürgikonteineritele klikkides."; } else { sobivKonteiner = "Prügi " + kasutajaInput.getText() + " ei leitud, äkki mõtlesid hoopis midagi neist : " + "\n" + voimalikPrygiList.prindiKonteineriList(); } kasutajaInput.clear(); Label sobivKonteinerLabel = new Label(sobivKonteiner); sobivKonteinerLabel.setMaxWidth(180); sobivKonteinerLabel.setWrapText(true); sobivKonteinerLayout.getChildren().add(sobivKonteinerLabel); }); leftVbox.getChildren().add(sobivKonteinerLayout); }
@FXML private void IsValide(ActionEvent event) { System.out.println("Test IsValide"); String wordtest = Rword.getText(); boolean valid = handeller.ValideWord(wordtest, hang.optionword); if (valid) { boolean trueword = handeller.lookforWord(wordtest); int sc = handeller.score(wordtest); if (trueword) { System.out.println("valide"); hang.score += sc; data.add(wordtest + " + " + sc); int t = handeller.randomimgs(); System.out.println("t -->" + t); Image image = new Image("/resource/imgS/" + t + ".gif"); img.setImage(image); if (handeller.updateOption(wordtest, hang.optionword)) { hang.score += 100; data.add("END + 100"); Reload(event); } else { Toption.setText(hang.optionword); } } else { System.out.println("Not valide"); hang.score -= sc; data.add(wordtest + " - " + sc); int t = handeller.randomimgf(); System.out.println("t -->" + t); Image image = new Image("/resource/imgF/" + t + ".gif"); img.setImage(image); } } else { System.out.println("Not valide"); hang.score -= 10; data.add("Out of Scope - 10"); Image image = new Image("/resource/out.gif"); img.setImage(image); } Tscore.setText("" + hang.score); Rword.clear(); }
/** * This is the method to pass the package from parser to the logic for execution. * * @param input User's input string */ private void execute(String input) { CommandPackage cmdPack = cmdParser.getCommandPackage(input); logger.log(Level.INFO, "CommandParser parses the command."); if (cmdPack == null) { System.out.println("input: " + input); feedback.setText(invalidMsg); } else { assert (cmdPack != null); try { System.out.println(input); String result = logic.executeCommand(cmdPack); feedback.setText(result); txtCommandInput.clear(); taskTableView.setItems(mainApp.getTaskData()); logger.log(Level.INFO, "Update the table view."); } catch (InvalidCommandException e) { feedback.setText(e.getMessage()); } } }
/** Main actions invoked by key "Enter" */ private void enterKeyEvent() { String input = txtCommandInput.getText(); // If the input is empty, return to the normal task list. if (input == null || input.isEmpty() || input.trim().length() == 0) { logic.setIsSearchOp(false); taskTableView.setItems(mainApp.getTaskData()); } else { // for command stack pastCommands.push(input); // Differentiate different command types.Handle help windows here. if (input.equalsIgnoreCase("exit")) { mainApp.exit(); txtCommandInput.clear(); } else if (input.equalsIgnoreCase("help")) { mainApp.indexHelp(); txtCommandInput.clear(); } else if (input.equalsIgnoreCase("sos")) { mainApp.sos(); txtCommandInput.clear(); } else if (input.equalsIgnoreCase("basic") || input.equalsIgnoreCase("`hb")) { mainApp.basic(); txtCommandInput.clear(); } else if (input.equalsIgnoreCase("advance") || input.equalsIgnoreCase("`ha")) { mainApp.advance(); txtCommandInput.clear(); } else if (input.equalsIgnoreCase("shortcut") || input.equalsIgnoreCase("shortcuts") || input.equalsIgnoreCase("shortform") || input.equalsIgnoreCase("shortforms") || input.equalsIgnoreCase("`sc")) { mainApp.shortForm(); txtCommandInput.clear(); } else if (input.equalsIgnoreCase("credit") || input.equalsIgnoreCase("`cd")) { mainApp.credit(); txtCommandInput.clear(); } else { // if the command does not belong to any commands above, pass it to the parser and logic String inputCommand = txtCommandInput.getText().trim(); logger.log(Level.INFO, "Here comes a command."); execute(inputCommand); } } }
// cadastrando usuarios em uma arrayList public void cadastraUsuario(ActionEvent event) { Usuario usu = new Usuario(); usu.setNomeUsuario(nomeUsu.getText()); usu.setEnderecoUsuario(endereco.getText()); usu.setTelefoneUsuario(telefone.getText()); usu.setEmailUsuario(email.getText()); usu.setIdUsuario(id.getText()); usu.setSenhaUsuario(senha.getText()); pessoas.add(usu); nomeUsu.clear(); endereco.clear(); telefone.clear(); email.clear(); id.clear(); senha.clear(); System.out.println(pessoas.size()); }
private void clearAll() { fromCombo.getItems().clear(); toCombo.getItems().clear(); fromFld.clear(); toFld.clear(); }
@FXML public void cancelar(ActionEvent evento) { txtfNombre.clear(); dialogStage.close(); }
@FXML private void playerSetup(ActionEvent e) throws NullPointerException { Stage newStage = new Stage(); // try { if (e.getSource() == nextButton2) { String name = playerName.getText(); String race = raceChoice.getSelectionModel().getSelectedItem().toString(); if (race.length() > 8) { race = race.toUpperCase().substring(0, race.indexOf(" ")); } else { race = race.toUpperCase(); } Player.Race r = Player.Race.valueOf(race); Color color = colorPick.getValue(); // creating Player Player p = new Player(name, r, color.toString()); players[count - 1] = p; if (players[players.length - 1] != null) { // when players array is full, begins game turns Turns gameTurns = new Turns(players); } if (name.equals("")) { // check if player entered a name Launcher.primaryStage.setScene(Launcher.errorMessage); Launcher.primaryStage.setTitle("Enter name!"); } else if (playerColors.contains(color)) { Launcher.primaryStage.setScene(Launcher.errorMessage); Launcher.primaryStage.setTitle("Choose new color!"); } else { playerColors.add(color); if (count == 1) { // if only one player config screen has been shown go to player 2 Launcher.primaryStage.setTitle("Player 2 Configuration"); Launcher.primaryStage.toFront(); playerName.clear(); raceChoice.getSelectionModel().clearSelection(); colorPick.setValue(Color.WHITE); count += 1; } else if (count == 2) { if (count == numPlayer) { // if user selected only 2 players then show game screen Launcher.primaryStage.hide(); try { gameRoot = FXMLLoader.load(getClass().getResource("UIFiles/MainMap.fxml")); gameScene = new Scene(gameRoot); Parent startWindow = FXMLLoader.load(getClass().getResource("UIFiles/playerStart.fxml")); startScene = new Scene(startWindow); } catch (Exception e1) { e1.printStackTrace(); } newStage.setScene(gameScene); newStage.setTitle("Game Screen"); newStage.show(); GameController.beginTurn(); // creates land array landPlots = new Land[9][5]; // 5 rows, 9 columns, col = i, row = j int count = 0; for (int i = 0; i < landPlots.length; i++) { for (int j = 0; j < landPlots[0].length; j++) { Land newLand = new Land(i, j); newLand.setType(landTypes[count]); landPlots[i][j] = newLand; count++; } } } else { // if user selected more than 2 players, go on to player 3 config Launcher.primaryStage.setTitle("Player 3 Configuration"); Launcher.primaryStage.toFront(); playerName.clear(); raceChoice.getSelectionModel().clearSelection(); colorPick.setValue(Color.WHITE); count += 1; } } else if (count == 3) { if (count == numPlayer) { Launcher.primaryStage.hide(); try { gameRoot = FXMLLoader.load(getClass().getResource("UIFiles/MainMap.fxml")); gameScene = new Scene(gameRoot); Parent startWindow = FXMLLoader.load(getClass().getResource("UIFiles/playerStart.fxml")); startScene = new Scene(startWindow); } catch (Exception e1) { e1.printStackTrace(); } newStage.setScene(gameScene); newStage.setTitle("Game Screen"); newStage.show(); GameController.beginTurn(); // creates land array landPlots = new Land[9][5]; // 5 rows, 9 columns, col = i, row = j int count = 0; for (int i = 0; i < landPlots.length; i++) { for (int j = 0; j < landPlots[0].length; j++) { Land newLand = new Land(i, j); newLand.setType(landTypes[count]); landPlots[i][j] = newLand; count++; } } } else { Launcher.primaryStage.setTitle("Player 4 Configuration"); Launcher.primaryStage.toFront(); playerName.clear(); raceChoice.getSelectionModel().clearSelection(); colorPick.setValue(Color.WHITE); count += 1; } } else if (count == 4) { Launcher.primaryStage.hide(); try { gameRoot = FXMLLoader.load(getClass().getResource("UIFiles/MainMap.fxml")); gameScene = new Scene(gameRoot); Parent startWindow = FXMLLoader.load(getClass().getResource("UIFiles/playerStart.fxml")); startScene = new Scene(startWindow); } catch (Exception e1) { e1.printStackTrace(); } newStage.setScene(gameScene); newStage.setTitle("Game Screen"); newStage.show(); GameController.beginTurn(); // creates land array landPlots = new Land[9][5]; // 5 rows, 9 columns, col = i, row = j int count = 0; for (int i = 0; i < landPlots.length; i++) { for (int j = 0; j < landPlots[0].length; j++) { Land newLand = new Land(i, j); newLand.setType(landTypes[count]); landPlots[i][j] = newLand; count++; } } } } } else if (e.getSource() == backButton) { playerName.clear(); raceChoice.getSelectionModel().clearSelection(); colorPick.setValue(Color.WHITE); Launcher.primaryStage.setScene(Launcher.rootScene); Launcher.primaryStage.setTitle("M.U.L.E. Game Setup"); } /*} catch (NullPointerException error) { Launcher.primaryStage.setScene(Launcher.errorMessage); Launcher.primaryStage.setTitle("Error!"); }*/ }
@FXML public void cancelar(ActionEvent evento) { campoNuevaMateria.clear(); this.dialogStage.close(); }