/* /Check of de naam in de database gelijk is aan de textveld tfBeginUsername */ @FXML public void Login() throws IOException, SQLException, NotBoundException { try { // check if the user is already online. for (User usr : loginIn.getOnlineUsers()) { if (usr.getName().equals(tfBeginUsername.getText())) { Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle("Information"); alert.setHeaderText(null); alert.setContentText("User is already online"); alert.showAndWait(); } else if (loginIn.Login(tfBeginUsername.getText(), tfBeginPassword.getText()) != null) { user = loginIn.Login(tfBeginUsername.getText(), tfBeginPassword.getText()); LobbySession.user = user; userName = user.getName(); LbLobbyUserName.textProperty().bind(userNameProperty); loginIn.addToOnline(LobbySession.user); stage = (Stage) btBeginLogIn.getScene().getWindow(); root = FXMLLoader.load(getClass().getResource("Lobby.fxml")); Scene scene = new Scene(root); scene.getStylesheets().add((new File("css/Lobby.css")).toURI().toURL().toExternalForm()); stage.setScene(scene); stage.setResizable(false); stage.show(); } else { Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle("Information"); alert.setHeaderText(null); alert.setContentText("Please enter correct name and password"); alert.showAndWait(); } } if (loginIn.getOnlineUsers().isEmpty()) { user = loginIn.Login(tfBeginUsername.getText(), tfBeginPassword.getText()); LobbySession.user = user; userName = user.getName(); LbLobbyUserName.textProperty().bind(userNameProperty); loginIn.addToOnline(LobbySession.user); stage = (Stage) btBeginLogIn.getScene().getWindow(); root = FXMLLoader.load(getClass().getResource("Lobby.fxml")); Scene scene = new Scene(root); scene.getStylesheets().add((new File("css/Lobby.css")).toURI().toURL().toExternalForm()); stage.setScene(scene); stage.setResizable(false); stage.show(); } } catch (Exception ex) { System.out.println("Not working: " + ex); } }
private void selectDestFolder() { ListItem item = destDirectoryListView.getSelectionModel().getSelectedItem(); Alert confirm = new Alert(AlertType.CONFIRMATION); confirm.setTitle("ファイル移動"); confirm.setHeaderText(item.folder.getDestPath() + " に移動します。"); confirm.setOnCloseRequest( e -> { if (confirm.getResult() == ButtonType.OK) { try { item.folder.moveInto(this.targetFiles); Alert complete = new Alert(AlertType.INFORMATION); complete.setTitle("移動完了"); complete.setHeaderText(this.targetFiles.size() + " 件のファイルを移動しました。"); complete.setContentText("移動先:" + item.folder.getDestPath()); complete.show(); this.clear(); } catch (UncheckedIOException ex) { Alert error = new Alert(AlertType.ERROR); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ex.printStackTrace(pw); TextArea textArea = new TextArea(sw.toString()); error.getDialogPane().setExpandableContent(textArea); error.setContentText("ファイル保存中にエラーが発生しました。"); error.show(); } } }); confirm.show(); }
/** Met fin au programme et demande à l'utilisateur s'il veut sauvegarder. */ protected void quitter() { if (model.flagModif) { Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle("Sauvegarde du dictionnaire"); alert.setContentText("Voulez-vous enregistrer les nouvelles modifications au dictionnaire?"); alert.setHeaderText(null); ButtonType yes = new ButtonType("Oui"); ButtonType no = new ButtonType("Non"); alert.getButtonTypes().setAll(yes, no); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == yes) { try { model.sauvegardeFichier(); } catch (IOException e) { e.printStackTrace(); Alert alertSave = new Alert(AlertType.ERROR); alertSave.setTitle("IO Error"); alertSave.setContentText("Save File error"); alertSave.showAndWait(); } } } System.exit(0); }
// @Override // public void setScreenParent(ScreensController screenParent) { // controller = screenParent; // } @FXML public void buttonClick(ActionEvent event) throws IOException { // controller.loadScreen(Main.createAdminFile); if (checkInfo()) { Alert emptyInfo = new Alert(Alert.AlertType.ERROR); emptyInfo.setTitle("Error"); emptyInfo.setHeaderText("Please make sure to correctly fill out the following: \n"); emptyInfo.setContentText(errorStr); emptyInfo.showAndWait(); } else { groupDir = Paths.get("").toAbsolutePath().toString() + "\\" + groupUsernameField.getText(); if (!Files.exists(Paths.get(groupDir))) { saveData(); Stage stage = (Stage) groupNext.getScene().getWindow(); Parent root = FXMLLoader.load(getClass().getResource(Main.createAdminFile)); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); } else { Alert emptyInfo = new Alert(Alert.AlertType.ERROR); emptyInfo.setTitle("Error: Company exists"); emptyInfo.setHeaderText(null); emptyInfo.setContentText( "Company by that name already exists in the system. Please enter a new company name."); emptyInfo.showAndWait(); } // Files.delete(file.toPath()); } }
@FXML private void calcular() { try { if (interprete.checarParentesis(txtFuncion.getText())) { interprete.setFuncion(txtFuncion.getText()); if (truncamiento.isSelected()) { interprete.setTipoValores(1); } else { interprete.setTipoValores(2); } getK(); txtResultado.setText( interprete.getFlotante(new BigDecimal(interprete.getResultado())) + ""); setOperaciones(); } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Información"); alert.setContentText( "Error de sintaxis. Verifique que haya escrito la función correctamente"); alert.showAndWait(); } } catch (Exception e) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Información"); alert.setContentText( "Error de sintaxis. Verifique que haya escrito la función correctamente"); alert.showAndWait(); } }
@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(); } }
public void alert() { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Warning"); alert.setHeaderText("Internet Connection"); alert.setContentText("No Internet Connection!"); alert.showAndWait(); }
public static void showInfoPopup(String title, String header, String content) { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle(title); alert.setHeaderText(header); alert.setContentText(content); alert.show(); }
public static void showErrorDialog(String header, String content) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle(ResourceManager.getMessage("title.dialog.error")); alert.setHeaderText(header); alert.setContentText(content); alert.showAndWait(); }
@FXML private void handleDeleteDepartment() { int selectedIndex = departmentTable.getSelectionModel().getSelectedIndex(); if (selectedIndex >= 0) { for (int i = main.getEmployees().size() - 1; i >= 0; i--) { ViewEmployee vEmp = main.getEmployees().get(i); if (vEmp.getDepartment() .equals(departmentTable.getSelectionModel().getSelectedItem().getName())) { for (ViewDepartment vDep : main.getDepartments()) { if (vDep.getDirectorName().equals(vEmp.getLastName() + " " + vEmp.getFirstName())) { vDep.setDirectorName("-"); } } main.getEmployees().remove(vEmp); } } con.deleteDepartment(departmentTable.getSelectionModel().getSelectedItem().getId()); departmentTable.getItems().remove(selectedIndex); } else { Alert alert = new Alert(AlertType.WARNING); alert.initOwner(main.getPrimaryStage()); alert.setTitle("Ничего не выбрано"); alert.setHeaderText("Не выбран отдел"); alert.setContentText("Пожалуйста, выберите отдел"); alert.showAndWait(); } }
public void getWarningAlert(String title, String headerText, String contentText) { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle(title); alert.setHeaderText(headerText); alert.setContentText(contentText); alert.showAndWait(); }
/** *************************Warning Pop Up Window************************** */ private void warning(String text) { Alert alert = new Alert(AlertType.WARNING); alert.setTitle("Warning"); alert.setHeaderText("Warning"); alert.setContentText(text); alert.showAndWait(); }
private void showErrorDialog(final String headerText, final String contentText) { final Alert alert = new Alert(AlertType.ERROR); // alert.setTitle("Error"); alert.setHeaderText(headerText); alert.setContentText(contentText); alert.showAndWait(); }
private void showDialog(String title, String message, Throwable throwable) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle(title); alert.setHeaderText(title); alert.setContentText(message); StringWriter stringWriter = new StringWriter(); PrintWriter printwriter = new PrintWriter(stringWriter); throwable.printStackTrace(printwriter); String exceptionText = stringWriter.toString(); Label label = new Label("The exception stacktrace was:"); TextArea textArea = new TextArea(exceptionText); textArea.setEditable(false); textArea.setWrapText(true); textArea.setMaxWidth(Double.MAX_VALUE); textArea.setMaxHeight(Double.MAX_VALUE); GridPane.setVgrow(textArea, Priority.ALWAYS); GridPane.setHgrow(textArea, Priority.ALWAYS); GridPane expContent = new GridPane(); expContent.setMaxWidth(Double.MAX_VALUE); expContent.add(label, 0, 0); expContent.add(textArea, 0, 1); alert.getDialogPane().setExpandableContent(expContent); alert.showAndWait(); }
public DodanoPracownikaException() { Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle("Uwaga!"); alert.setHeaderText(null); alert.setContentText("Zapisano dane pracownika"); alert.showAndWait(); }
public static void showWarningPopup(String title, String header, String content) { Alert alert = new Alert(Alert.AlertType.WARNING); alert.setTitle(title); alert.setHeaderText(header); alert.setContentText(content); alert.show(); }
public void validateAction() { if ((!this.emailFirstPart.getText().isEmpty()) && (!this.emailSecondPart.getText().isEmpty()) && (!this.emailThirdPart.getText().isEmpty())) { AppUser.user.setProfileImage(this.profileImageView.getImage()); AppUser.user.setEmail( this.emailFirstPart.getText() + "@" + this.emailSecondPart.getText() + "." + this.emailThirdPart.getText()); if (!this.passwordField1.getText().isEmpty()) { // TODO } this.stage.close(); } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Erreur"); alert.setHeaderText(null); alert.setContentText("Un des champs de l'addresse mail est vide."); alert.showAndWait(); } }
/** * Displays alert when there are no possible results. * * @param term - term that had no results. */ private void noResultError(String term) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("No results found"); alert.setHeaderText("0 Results found for " + term + "."); alert.setContentText("Try a different spelling or something."); alert.showAndWait(); }
@FXML void processLoadGame(ActionEvent event) { GestorLogs.registrarLog("Reanudando Juego..."); String fxml = ConstantesFXML.FXML_REANUDAR_JUEGO; ReanudarJuegoController controller; try { Stage reanudarJuegoStage = new Stage(); controller = (ReanudarJuegoController) FXUtils.cargarStage( reanudarJuegoStage, fxml, "Monopoly - Reanudar juego", false, false, Modality.APPLICATION_MODAL, StageStyle.UTILITY); controller.setCurrentStage(reanudarJuegoStage); controller.setPrevStage(currentStage); controller.setUsuarioLogueado(usuarioLogueado); int senderId = ConnectionController.getInstance().getIdPlayer(); ConnectionController.getInstance().send(new GetSavedGamesMessage(senderId, usuarioLogueado)); } catch (Exception ex) { GestorLogs.registrarException(ex); final Alert alert = new Alert(AlertType.ERROR); alert.setTitle("Error..."); alert.setContentText(ex.getMessage()); alert.getButtonTypes().setAll(new ButtonType("Aceptar", ButtonData.OK_DONE)); alert.showAndWait(); } }
@FXML private void lvListenerGetEmployeeInfo(MouseEvent event) { try { tabPayCheck.setDisable(true); clearTextFields(); String[] a = lvEmployees.getSelectionModel().getSelectedItem().split("-"); tfInfoId.setText(a[1].trim()); final int ID = Integer.parseInt(tfInfoId.getText()); tfInfoName.setText(Environment.getEmployeeStrInfo(ID, "name")); tfInfoPos.setText(Environment.getEmployeeStrInfo(ID, "position")); tfInfoStreet.setText(Environment.getEmployeeStrInfo(ID, "street")); tfInfoCSZ.setText(Environment.getCityStateZip(ID)); tfInfoPayRate.setText( String.format("%.2f", Double.parseDouble(Environment.getEmployeeStrInfo(ID, "payRate")))); } catch (Exception e) { Alert alert; alert = new Alert(AlertType.CONFIRMATION); alert.setTitle("Error Message"); alert.setHeaderText("Whoops you did not select an Employee."); alert.setContentText("Try again."); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { // ... user chose OK } else { // ... user chose CANCEL or closed the dialog } } }
public static void showInformationDialog(String message) { Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle("Information"); alert.setHeaderText(null); alert.setContentText(message); alert.showAndWait(); }
/** * Displays alert that the user's temr is being changed to suggestion. * * @param term - original query. * @param suggestion - suggested query. */ private void spellCheckAlert(String term, String suggestion) { Alert alert = new Alert(Alert.AlertType.WARNING); alert.setTitle("No results found"); alert.setHeaderText("0 Results found for " + term + "."); alert.setContentText("Trying " + suggestion + " instead."); alert.showAndWait(); }
public static void showErrorDialog(String message) { Alert alert = new Alert(AlertType.ERROR); alert.setTitle("Error"); alert.setHeaderText(null); alert.setContentText(message); alert.showAndWait(); }
public static void showWarnDialog(String message) { Alert alert = new Alert(AlertType.WARNING); alert.setTitle("Warning"); alert.setHeaderText(null); alert.setContentText(message); alert.showAndWait(); }
public void showAbout() { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle("О программе"); alert.setHeaderText("Grain"); alert.setContentText("Программа для расчета цены за партию зерна."); alert.show(); }
/** * @param event event of button * @throws GroupNotValidException not valid * @throws IDNotValidException not valid * @throws StringNotValidException not valid */ public final void onBtnGroupClick(final ActionEvent event) throws GroupNotValidException, IDNotValidException, StringNotValidException { try { Object item = disabled.getSelectionModel().getSelectedItem(); Button button = (Button) event.getSource(); // add a group if (button.getText().equals("<<")) { if (item.toString().equals("Arbeit")) { INACTIVEDATA.remove(item); ACTIVEDATA.add(item); c.addToGroup(Main.getWorkGroup()); } if (item.toString().equals("Familie")) { INACTIVEDATA.remove(item); ACTIVEDATA.add(item); c.addToGroup(Main.getFamilyGroup()); } if (item.toString().equals("Freunde")) { INACTIVEDATA.remove(item); ACTIVEDATA.add(item); c.addToGroup(Main.getFriendsGroup()); } } // remove a group item = enabled.getSelectionModel().getSelectedItem(); if (button.getText().equals(">>")) { if (item.toString().equals("Arbeit")) { ACTIVEDATA.remove(item); INACTIVEDATA.add(item); c.removeFromGroup(Main.getWorkGroup()); } if (item.toString().equals("Familie")) { ACTIVEDATA.remove(item); INACTIVEDATA.add(item); c.removeFromGroup(Main.getFamilyGroup()); } if (item.toString().equals("Freunde")) { ACTIVEDATA.remove(item); INACTIVEDATA.add(item); c.removeFromGroup(Main.getFriendsGroup()); } } } catch (Exception e) { Alert alert = new Alert(AlertType.ERROR); alert.setTitle("Keine gültige Gruppe erkannt."); alert.setHeaderText(""); alert.setContentText("Es wurde keine gültige Gruppe erkannt. Klicke auf gültige Gruppe."); alert.showAndWait(); logger.log(Level.SEVERE, "Error: " + e.getMessage()); } }
private void confirmAlert() { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle("Item Accepted"); alert.setHeaderText(null); alert.setContentText("Item #" + itemCount + " accepted."); alert.show(); }
private void bookNotFoundAlert(String id) { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle("Book Not on File!"); alert.setHeaderText(null); alert.setContentText("Book ID: " + id + " is not in our inventory."); alert.show(); }
public static void showInformationAlter(String title, String contents) { Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle(title); alert.setHeaderText(null); alert.setContentText(contents); alert.showAndWait(); }
/** * Shows dialog for user input error * * @param inErr - message to dispaly */ public void showInputErrorDialog(String inErr) { Alert alert = new Alert(AlertType.ERROR); alert.setTitle("Error"); alert.setHeaderText("Input Error"); alert.setContentText(inErr); alert.showAndWait(); }