List of usage examples for javafx.scene.control Alert Alert
public Alert(@NamedArg("alertType") AlertType alertType)
From source file:com.jscriptive.moneyfx.ui.account.AccountFrame.java
private void deleteAccount() { Alert alert = new Alert(CONFIRMATION); alert.setTitle("Delete account"); alert.setHeaderText("Confirm delete account"); AccountItem selectedItem = dataTable.getSelectionModel().getSelectedItem(); alert.setContentText(String.format( "Are you sure you want to delete the selected account: %s %s? All transactions of that account will also be deleted.", selectedItem.getBank(), selectedItem.getNumber())); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == OK) { int selectedIndex = dataTable.getSelectionModel().getSelectedIndex(); Account account = accountRepository.findByNumber(selectedItem.getNumber()); transactionRepository.removeByAccount(account); accountRepository.remove(account); accountData.remove(selectedIndex); }/*from w ww .ja v a2 s . c o m*/ }
From source file:Watcher.FXMLDocumentController.java
@FXML protected void clear(MouseEvent event) { if (event.isPrimaryButtonDown()) { Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle("Warning"); alert.setHeaderText("Deleting statistics"); alert.setContentText("Are you sure you want to delete statistics? It's not reversable!"); alert.initOwner(JavaFXApplication4.getStage()); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { if (HSQL_Manager.clearStat(getSelectedItem())) { processor.renew(getSelectedItem()); }/*w w w.jav a2 s.c om*/ } } }
From source file:dpfmanager.shell.interfaces.gui.component.dessign.DessignController.java
public void addConfigFile(File file, boolean ask) { if (file != null) { // Check valid config if (!readConfig(file.getPath())) { getContext().send(BasicConfig.MODULE_MESSAGE, new AlertMessage(AlertMessage.Type.ERROR, DPFManagerProperties.getBundle().getString("errorReadingConfFile"))); file = null;/*from ww w. j a v a 2 s . com*/ } } if (file != null && ask) { DPFManagerProperties.setDefaultDirConfig(file.getParent()); Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle(getBundle().getString("copyTitle")); alert.setHeaderText(getBundle().getString("copyHeader")); alert.setContentText(getBundle().getString("copyContent")); ButtonType buttonTypeYes = new ButtonType(getBundle().getString("yes")); ButtonType buttonTypeNo = new ButtonType(getBundle().getString("no")); alert.getButtonTypes().setAll(buttonTypeYes, buttonTypeNo); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == buttonTypeYes) { // Copy the file boolean needAdd = true; boolean error = false; File configFile = new File(DPFManagerProperties.getConfigDir() + "/" + file.getName()); if (configFile.exists()) { configFile.delete(); needAdd = false; } try { FileUtils.copyFile(file, configFile); } catch (IOException e) { error = true; } if (error) { // Add source file String description = readDescription(file); getView().addConfigFile(file.getAbsolutePath(), description, false); getContext().send(BasicConfig.MODULE_MESSAGE, new AlertMessage(AlertMessage.Type.WARNING, getBundle().getString("errorCopyConfig"))); } else if (needAdd) { String description = readDescription(configFile); getView().addConfigFile(configFile.getName(), description, false); } } else { String description = readDescription(file); getView().addConfigFile(file.getAbsolutePath(), description, false); } } else if (file != null && !ask) { getView().addConfigFile(file.getAbsolutePath(), readDescription(file), false); } }
From source file:org.martus.client.swingui.PureFxMainWindow.java
public void showMessageDialog(String message) { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle("Message"); alert.setHeaderText(null);/*from w ww . jav a 2 s . c om*/ alert.setContentText(message); alert.showAndWait(); }
From source file:ninja.javafx.smartcsv.fx.SmartCSVController.java
@FXML public void about(ActionEvent actionEvent) { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle("About"); alert.setHeaderText("SmartCSV.fx"); alert.getDialogPane().setContent(aboutController.getView()); alert.showAndWait();// w ww . jav a2 s . com }
From source file:ui.main.MainViewController.java
@FXML public void handleFriendRequestButtonAction(ActionEvent event) { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle("Confirmation"); alert.setHeaderText("Accept Friend Request!"); alert.setContentText("Are you sure to add the this user as a friend?"); ButtonType buttonTpeYes = new ButtonType("Yes"); ButtonType buttonTypeNo = new ButtonType("Not Now"); ButtonType buttonTypeCancel = new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE); alert.getButtonTypes().setAll(buttonTpeYes, buttonTypeNo, buttonTypeCancel); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == buttonTpeYes) { contactsManager.acceptFriend(currentChat.getParticipant()); friendRequest.setVisible(false); } else if (result.get() == buttonTypeNo) { // ... no thing to do } else {/* w w w .j a v a 2 s. c om*/ // ... user chose CANCEL or closed the dialog } }
From source file:org.martus.client.swingui.PureFxMainWindow.java
protected void initializationErrorExitMartusDlg(String message) { String title = "Error Starting Martus"; String cause = "Unable to start Martus: \n" + message; Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle(title);/*from w w w . j a v a 2 s . co m*/ alert.setHeaderText(null); alert.setContentText(cause); alert.showAndWait(); System.exit(1); }
From source file:com.rcs.shoe.shop.fx.controller.ui.NewProductController.java
private void showProductCodePopup() { Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle("ifra proizvoda!"); alert.setHeaderText("ifra ne moe biti prazna!"); alert.setContentText(""); ButtonType okButton = new ButtonType("Nastavi", ButtonData.OK_DONE); alert.getButtonTypes().setAll(okButton); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); stage.getIcons().add(uIConfig.getIcon()); alert.showAndWait();//from w ww. ja va2 s .c o m }
From source file:ninja.javafx.smartcsv.fx.SmartCSVController.java
@FXML public void preferences(ActionEvent actionEvent) { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setGraphic(null);//from www . j a v a2 s. co m alert.setTitle(resourceBundle.getString("dialog.preferences.title")); alert.setHeaderText(resourceBundle.getString("dialog.preferences.header.text")); alert.getDialogPane().setContent(preferencesController.getView()); Node okButton = alert.getDialogPane().lookupButton(ButtonType.OK); okButton.disableProperty().bind(preferencesController.validProperty().not()); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { CsvPreference csvPreference = preferencesController.getCsvPreference(); setCsvPreference(csvPreference); saveCsvPreferences(csvPreference); } else { preferencesController.setCsvPreference(csvPreferenceFile.getContent()); } }
From source file:hd3gtv.as5kpc.Serverchannel.java
void appInitialize(ControllerUpdater updater) { AboutServerbackgound absb = createAboutServerbackgound(); absb.setOnSucceeded((WorkerStateEvent event_absb) -> { ServerResponseAbout about = absb.getValue(); updater.updateVTRMedia(getVtrIndex(), "PROTOCOL VERSION: " + about.getVersion(), ""); if (about.isCan_record()) { updater.updateVTRStatus(getVtrIndex(), about.getOsd_name() + " #" + about.getCh_num(), about.getChannel_name(), "--:--:--:--", "Loading..."); } else {/* www . j a v a 2 s . c o m*/ updater.updateVTRStatus(getVtrIndex(), about.getOsd_name() + " #" + about.getCh_num(), about.getChannel_name(), "--:--:--:--", "CAN'T RECORD"); return; } BackgroundWatcher bw = createBackgroundWatcher(); bw.setDelay(Duration.seconds(1)); bw.setOnSucceeded((WorkerStateEvent event_bw) -> { ServerResponseStatus status = bw.getValue(); String warn = ""; if (status.isRec_mode() == false) { warn = "Standby"; } else if (status.isHas_video() == false) { warn = "NO VIDEO!"; } updater.updateVTRStatus(getVtrIndex(), about.getOsd_name(), status.getControl(), status.getActual_tc(), warn); updater.updateVTRMedia(getVtrIndex(), status.getActive_name(), status.getActive_id()); }); bw.start(); }); absb.setOnFailed((WorkerStateEvent event_absb_e) -> { Alert alert = new Alert(AlertType.ERROR); alert.setTitle("Erreur"); alert.setHeaderText("Impossible de communiquer avec le serveur"); alert.setContentText("La machine " + toString() + " n'est pas joignable. Verifiez vos parametres rseau et la configuration du client et/ou du serveur."); alert.showAndWait(); System.exit(1); }); absb.start(); }