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 showAbout() { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle("О программе"); alert.setHeaderText("Grain"); alert.setContentText("Программа для расчета цены за партию зерна."); 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(); }
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 void alert() { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Warning"); alert.setHeaderText("Internet Connection"); alert.setContentText("No Internet Connection!"); alert.showAndWait(); }
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(); }
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 showError(String error) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Error"); alert.setHeaderText("Uh oh..."); alert.setContentText(error); alert.showAndWait(); }
public void exit() { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle("Quit?"); alert.setHeaderText("You've selected to quit this program."); alert.setContentText("Are you sure you want to quit?"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) System.exit(0); }
private void invoiceAlert(String message) { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle("Invoice"); alert.setHeaderText(null); alert.setContentText(message); alert.getDialogPane().setStyle(" -fx-max-width:500px; -fx-pref-width: 500px;"); alert.show(); }
private void endGame() { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle("Game Over"); alert.setHeaderText("That's it, you failed"); alert.setContentText("Score: -1"); alert.setOnCloseRequest(e -> sm.setStage(StateManager.STATE_MENU)); alert.showAndWait(); }
private void initSuccessAlert() { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setHeaderText("Saving successful!"); alert.setTitle("Saving successful"); alert.setContentText( "A new Match between " + _allTeamsTableView.getSelectionModel().getSelectedItem().getName() + " and " + _allTeamsOpponentTableView.getSelectionModel().getSelectedItem().getName() + " was saved successfully!"); alert.showAndWait(); }
public static boolean showConfirmPopup( Node graphic, String title, String header, String content) { Alert alert = new Alert(Alert.AlertType.CONFIRMATION, content, ButtonType.YES, ButtonType.NO); if (graphic != null) { alert.setGraphic(graphic); } alert.setTitle(title); alert.setHeaderText(header); Optional<ButtonType> result = alert.showAndWait(); return result.get() == ButtonType.YES; }
public void viewOrder() { String currentOrder = ""; int counter = 0; for (Item i : order.getOrder()) { counter++; currentOrder += counter + ". " + i.toString() + "\n"; } Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle("Current Order"); alert.setHeaderText("Your current order is as follows:"); alert.setContentText(currentOrder); alert.getDialogPane().setStyle(" -fx-max-width:500px; -fx-pref-width: 500px;"); alert.showAndWait(); }
@FXML private void handleAfficherObjectif() { Chapitre selectedChapitre = chapitreDisplayChapitreTable.getSelectionModel().getSelectedItem(); if (selectedChapitre != null) { showObjectifDialog(selectedChapitre.getId()); } else { // Nothing selected. Alert alert = new Alert(AlertType.WARNING); alert.initOwner(primaryStage); alert.setTitle("No Selection"); alert.setHeaderText("No Chapitre Selected"); alert.setContentText("Please select a cours in the table."); alert.showAndWait(); } }
@FXML private void handleDeleteChapitre() throws SQLException { int selectedIndex = chapitreDisplayChapitreTable.getSelectionModel().getSelectedIndex(); Chapitre chapitre = new Chapitre(); chapitre = chapitreDisplayChapitreTable.getSelectionModel().getSelectedItem(); if (selectedIndex >= 0) { Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle("Suppression !!!"); alert.setHeaderText("Etes-vous sur de bien vouloir supprimer '" + chapitre.getNom() + "'"); // alert.setContentText("Are you ok with this?"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { chapitreDisplayChapitreTable.getItems().remove(selectedIndex); chapitreDAO = new ImplChapitreDAO(); chapitreDAO.deleteChapitre(chapitre.getId()); } } }
@FXML private void handleEditChapitre() { Chapitre selectedChapitre = chapitreDisplayChapitreTable.getSelectionModel().getSelectedItem(); if (selectedChapitre != null) { boolean modifierClicked = showChapitreEditDialog(selectedChapitre); if (modifierClicked) { showChapitreDetails(selectedChapitre); } } else { // Nothing selected. Alert alert = new Alert(AlertType.WARNING); alert.initOwner(primaryStage); alert.setTitle("No Selection"); alert.setHeaderText("No Chapitre Selected"); alert.setContentText("Please select a cours in the table."); alert.showAndWait(); } }
void deletePlaylist() { if (interfaceDisabled) return; Playlist p = getSelectedPlaylist(); if (p == null) return; Alert alert = new Alert(AlertType.CONFIRMATION); ButtonType btYes = new ButtonType(res.getString("yes"), ButtonBar.ButtonData.YES); ButtonType btCancel = new ButtonType(res.getString("cancel"), ButtonBar.ButtonData.CANCEL_CLOSE); alert.getButtonTypes().setAll(btYes, btCancel); alert.setTitle(res.getString("delete_playlist")); alert.setHeaderText(res.getString("delete_playlist")); alert.setContentText(String.format(res.getString("delete_confirm"), p.getTitle())); alert.getDialogPane().getStylesheets().add("/styles/dialogs.css"); ((Stage) alert.getDialogPane().getScene().getWindow()).getIcons().addAll(logoImages); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == btYes) { Cache.deletePlaylist(p); Platform.runLater( () -> { updatePlaylists(); }); } }
public void initialize() { // if (Objects.equals(System.getProperty("os.name"), "Mac OS X")){ // // } JSON json = new JSON(); String[] result = json.returner(); String name1 = result[3].replace(".zip", ""); JCalPropertiesReader jCalPropertiesReader = new JCalPropertiesReader(); String[] strings = jCalPropertiesReader.reader(); new PropertiesWriter(name1, strings[5], result[1], result[2]); Text text1 = new Text(result[2]); text1.setFont(Font.font("Courier New", FontWeight.BOLD, 15)); name.setFont(Font.font("", FontWeight.BOLD, 12)); name.setText(name1); newVersion.setFont(Font.font("", FontWeight.BOLD, 12)); newVersion.setText(result[1]); PropertiesReader propertiesReader = new PropertiesReader(); String[] tempString = propertiesReader.reader(); currentVersion.setText(tempString[1]); if (Objects.equals(result[1], tempString[1])) { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle("GUpdater"); alert.setHeaderText("JCal up to date"); alert.setContentText("Looks like your software is up to date"); Optional<ButtonType> result1 = alert.showAndWait(); if (result1.get() == ButtonType.OK) { Platform.exit(); } } summary.getChildren().add(text1); close.setOnAction(event -> Platform.exit()); update.setOnAction( event -> { Window ownerWindow = ((Node) event.getTarget()).getScene().getWindow(); Stage stage = new Stage(); stage.initStyle(StageStyle.UNDECORATED); stage.initModality(Modality.APPLICATION_MODAL); stage.initOwner(ownerWindow); Parent parent = null; try { parent = FXMLLoader.load(getClass().getResource("/resource/GUpdater-progress.fxml")); } catch (IOException e) { e.printStackTrace(); } assert parent != null; Scene scene = new Scene(parent, 600, 148); stage.setResizable(false); stage.getIcons().add(new Image("/resource/g-4.png")); stage.setTitle("GUpdater"); stage.setScene(scene); stage.show(); }); cancel.setOnAction(event -> Platform.exit()); }
@Override public void start(Stage primaryStage) throws Exception { // UI fields VBox mainBox = new VBox(); sequenceField = new TextField(myLabels.TEXTAREA_SEQUENCE); bracketField = new TextField(myLabels.TEXTAREA_BRACKET); HBox buttonBox = new HBox(); Button computeButton = new Button(myLabels.BUTTON_COMPUTE); Button drawButton = new Button(myLabels.BUTTON_DRAW); CheckBox animateChecker = new CheckBox(myLabels.CHECKBOX_ANIMATE); drawPane = new Pane(); buttonBox.getChildren().addAll(computeButton, drawButton, animateChecker); mainBox.getChildren().addAll(sequenceField, bracketField, buttonBox, drawPane); // Compute Button disable sequenceField .textProperty() .addListener( (observable, oldValue, newValue) -> { if (newValue.length() == 0) { computeButton.setDisable(true); } else { computeButton.setDisable(false); } }); // Animate Checkbox animateChecker.setOnAction( (value) -> { if (animateChecker.isSelected() != isAnimated) { isAnimated = animateChecker.isSelected(); // set Eventhandler für Drag & Drop for (Circle currentCircle : circleList) { currentCircle.setOnMousePressed(isAnimated ? circleOnMousePressedEventHandler : null); currentCircle.setOnMouseDragged(isAnimated ? circleOnMouseDraggedEventHandler : null); currentCircle.setOnMouseReleased( isAnimated ? circleOnMouseReleasedEventHandler : null); } } }); // computeButton computeButton.setOnAction( (value) -> { bracketField.setText(new Nussinov(sequenceField.getText()).getBracketNotation()); }); // drawButton drawButton.setOnAction( (value) -> { Graph myGraph = new Graph(); try { myGraph.parseNotation(bracketField.getText()); } catch (IOException e) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle(myLabels.ALERT_TITLE); alert.setHeaderText(myLabels.ALTERT_MESSAGE); alert.setContentText(bracketField.getText()); alert.showAndWait(); } coordsRepresentation[0] = SpringEmbedder.computeSpringEmbedding( iterations, myGraph.getNumberOfNodes(), myGraph.getEdges(), null); SpringEmbedder.centerCoordinates(coordsRepresentation[0], 50, 550, 50, 550); drawShapes( drawPane, coordsRepresentation[0], myGraph.getEdges(), myGraph.getNumberOfNodes()); }); // prepare scene Scene scene = new Scene(mainBox, 600, 800); primaryStage.setScene(scene); primaryStage.setTitle(myLabels.CAPTION); // show scene primaryStage.show(); }
private void display() { // create labels and textfields Label lbl_klantNaam = new Label("Klant naam:"); lbl_klantNaam.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_klantID = new Label("Klant email:"); lbl_klantID.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_klantAdres = new Label("Klant adres:"); lbl_klantAdres.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_factuurNummer = new Label("Factuur nummer:"); lbl_factuurNummer.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_factuurDatum = new Label("Factuur datum:"); lbl_factuurDatum.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_debiteurenNummer = new Label("Debiteuren nummer:"); lbl_debiteurenNummer.setTextFill((Color.valueOf("#FFFC00"))); String klantHeleNaam = klantVoornaam + " " + klantAchternaam; Label lbl_DklantNaam = new Label(klantHeleNaam); lbl_DklantNaam.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_DklantID = new Label(order.getKlantEmail()); lbl_DklantID.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_DklantAdres = new Label(order.getFactuurAdres()); lbl_DklantAdres.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_DfactuurNummer = new Label(Integer.toString(order.getOrderID())); lbl_DfactuurNummer.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_DfactuurDatum = new Label(order.getOrderDatum().toString()); lbl_DfactuurDatum.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_DdebiteurenNummer = new Label(Integer.toString(debiteurenNummer)); lbl_DdebiteurenNummer.setTextFill((Color.valueOf("#FFFC00"))); TextField tf_wijnnaam = new TextField(); TextField tf_prijs = new TextField(); table.setEditable(true); TableColumn<OrderRegel, Integer> codeCol = new TableColumn<>("Nr"); codeCol.setCellValueFactory(new PropertyValueFactory<>("orderRegelID")); TableColumn<OrderRegel, Integer> aantalCol = new TableColumn("Aantal"); aantalCol.setCellValueFactory(new PropertyValueFactory<>("aantal")); TableColumn<OrderRegel, Integer> wijnCol = new TableColumn("Wijn serie nr"); wijnCol.setCellValueFactory(new PropertyValueFactory<>("wijnID")); TableColumn<OrderRegel, String> naamCol = new TableColumn("Naam"); naamCol.setCellValueFactory(new PropertyValueFactory<>("wijnNaam")); TableColumn<OrderRegel, Integer> jaartalCol = new TableColumn("Jaartal"); jaartalCol.setCellValueFactory(new PropertyValueFactory<>("wijnJaartal")); TableColumn<OrderRegel, Integer> perflesCol = new TableColumn("Per fles"); perflesCol.setCellValueFactory(new PropertyValueFactory<>("wijnPrijs")); TableColumn<OrderRegel, Double> bedragCol = new TableColumn("Bedrag"); bedragCol.setCellValueFactory(new PropertyValueFactory<>("totaalPrijs")); table = new TableView<>(); ObservableList<OrderRegel> orders = FXCollections.observableArrayList(orderController.getAlleOrderRegels(order.getOrderID())); table.setItems(orders); table.getColumns().addAll(wijnCol, naamCol, jaartalCol, aantalCol, perflesCol, bedragCol); // topbox items title = new Label("Lions-club Oegstgeest/Warmond"); title.setId("title"); title.setTextFill(Color.web("#FFCF03")); title.autosize(); icon = new ImageView(new Image("/images/icon.png")); icon.setPreserveRatio(true); icon.autosize(); // buttons cancel = new Button("Terug"); cancel.setOnAction( e -> new BestellingOverzichtView(new OrderController(), new KlantController())); Button exporteer = new Button("Exporteer naar PDF"); exporteer.setOnAction( e -> { factuurGenerator = new FactuurGenerator(klantController.getKlantByOrder(order), order, orders); factuurGenerator.factuur(); Alert alert = new Alert(AlertType.INFORMATION); alert.setHeaderText(null); alert.setTitle("Exporteer naar PDF"); alert.setContentText("De factuur is succesvol ge�xporteerd. "); alert.showAndWait(); }); // add elements to panes topBox.getChildren().addAll(icon, title); topBox.setAlignment(Pos.CENTER); centerBox.getChildren().add(form); centerBox.getChildren().add(table); form.addColumn( 0, lbl_klantNaam, lbl_klantID, lbl_klantAdres, lbl_factuurNummer, lbl_factuurDatum, lbl_debiteurenNummer); form.addColumn( 1, lbl_DklantNaam, lbl_DklantID, lbl_DklantAdres, lbl_DfactuurNummer, lbl_DfactuurDatum, lbl_DdebiteurenNummer); form.addColumn(2, exporteer); bottomBox.getChildren().add(cancel); bottomBox.getChildren().add(exporteer); mainPane.setTop(topBox); mainPane.setCenter(centerBox); mainPane.setBottom(bottomBox); stage.setScene(scene); }
public static EventHandler<ActionEvent> getUploadHandler( FXController controller, ProgressBar progressBar, CheckBox stem) { return e -> { Alert a; if (selectedFiles != null) { controller.selectedFiles = new File[selectedFiles.size()]; for (int i = 0; i < selectedFiles.size(); i++) { String filepath = selectedFiles.get(i).getAbsolutePath(); if (lastUpload.contains(filepath)) { a = new Alert(Alert.AlertType.CONFIRMATION); a.setTitle("Are you sure?"); a.setContentText( "You just uploaded " + filepath + ", are you sure you want to upload it again?"); Optional<ButtonType> result = a.showAndWait(); if (result.get() != ButtonType.OK) { return; } } if (selectedFiles.get(i).isAbsolute() && selectedFiles.get(i).exists()) { controller.selectedFiles[i] = selectedFiles.get(i); } else { a = new Alert(Alert.AlertType.INFORMATION, "Invalid path to file.", ButtonType.OK); a.setTitle("Information"); a.showAndWait(); return; } } } else { a = new Alert(Alert.AlertType.INFORMATION, "Please select a file.", ButtonType.OK); a.initStyle(StageStyle.UTILITY); a.setTitle("Information"); a.showAndWait(); return; } progressBar.setProgress(0); controller.writeLog("Uploading file(s)..."); Button source = (Button) e.getSource(); source.setDisable(true); SwingWorker<Boolean, Double> worker = new SwingWorker<Boolean, Double>() { @Override protected Boolean doInBackground() throws Exception { String[] key = new String[FXController.selectedFiles.length]; publish(0.05); for (int i = 0; i < FXController.selectedFiles.length; i++) { key[i] = UUID.randomUUID().toString(); FileUtils.uploadFile(FXController.selectedFiles[i], key[i], AESCTR.secretKey); } publish(0.4); Map<String, ArrayList<StringPair>> map = SSE.EDBSetup( FXController.selectedFiles, AESCTR.secretKey, key, stem.isSelected()); publish(0.6); ObjectMapper mapper = new ObjectMapper(); try { String json = mapper.writeValueAsString(map); publish(0.8); HttpUtil.HttpPost(json); } catch (JsonProcessingException e1) { e1.printStackTrace(); return false; } publish(1.0); return true; } @Override protected void done() { Platform.runLater( new TimerTask() { @Override public void run() { Alert a; try { if (get()) { controller.writeLog("Upload successful!"); a = new Alert( Alert.AlertType.INFORMATION, "Upload successful!", ButtonType.OK); a.setTitle("Success!"); a.showAndWait(); lastUpload.clear(); for (File f : FXController.selectedFiles) { lastUpload.add(f.getAbsolutePath()); } } else { controller.writeLog("Upload failed!"); a = new Alert(Alert.AlertType.ERROR, "Upload failed!", ButtonType.OK); a.setTitle("Error!"); a.showAndWait(); } } catch (Exception ex) { a = new Alert(Alert.AlertType.ERROR, "Upload error!", ButtonType.OK); a.setTitle("Error!"); a.showAndWait(); ex.printStackTrace(); } source.setDisable(false); } }); } @Override protected void process(List<Double> n) { progressBar.setProgress(n.get(n.size() - 1)); } }; worker.execute(); }; }