Java Code Examples for javafx.scene.control.TextInputDialog#setContentText()
The following examples show how to use
javafx.scene.control.TextInputDialog#setContentText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArduinoLibraryInstaller.java From tcMenu with Apache License 2.0 | 6 votes |
/** * This method will be called internally by the above method when a non standard layout is detected. * * @return the arduino path wrapped in an optional, or nothing if cancel is pressed. */ private Optional<String> getArduinoPathWithDialog() { String savedPath = Preferences.userNodeForPackage(ArduinoLibraryInstaller.class) .get(ARDUINO_CUSTOM_PATH, homeDirectory); Path libsPath = Paths.get(savedPath, "libraries"); if (Files.exists(libsPath)) return Optional.of(savedPath); TextInputDialog dialog = new TextInputDialog(savedPath); dialog.setTitle("Manually enter Arduino Path"); dialog.setHeaderText("Please manually enter the full path to the Arduino folder"); dialog.setContentText("Arduino Path"); Optional<String> path = dialog.showAndWait(); path.ifPresent((p) -> Preferences.userNodeForPackage(ArduinoLibraryInstaller.class).put(ARDUINO_CUSTOM_PATH, p)); return path; }
Example 2
Source File: AddWebActionHandler.java From Quelea with GNU General Public License v3.0 | 6 votes |
@Override public void handle(ActionEvent t) { TextInputDialog dialog = new TextInputDialog("http://"); dialog.setTitle(LabelGrabber.INSTANCE.getLabel("website.dialog.title")); dialog.setHeaderText(LabelGrabber.INSTANCE.getLabel("website.dialog.header")); dialog.setContentText(LabelGrabber.INSTANCE.getLabel("website.dialog.content")); dialog.setGraphic(new ImageView(new Image("file:icons/website.png"))); Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow(); stage.getIcons().add(new Image("file:icons/web-small.png")); Optional<String> result = dialog.showAndWait(); if (result.isPresent()) { String url = result.get(); if (!url.startsWith("http")) { url = "http://" + url; } WebDisplayable displayable = new WebDisplayable(url); QueleaApp.get().getMainWindow().getMainPanel().getSchedulePanel().getScheduleList().add(displayable); } }
Example 3
Source File: ClientDisplay.java From Open-Lowcode with Eclipse Public License 2.0 | 6 votes |
/** * @param title null if user pressed cancel, or the text entered if pressed * OK (if pressed OK with no text entered, empty string is * brought back * @param textlength the maximum length of text to enter * @return */ public String showModalTextEntry(String title, int textlength) { logger.fine("NormalTextEntry " + title + " - " + textlength); logger.fine(" prepare to launch dialog"); TextInputDialog dialog = new TextInputDialog(); dialog.setHeaderText("Enter Update Note below"); dialog.setContentText(""); Optional<String> result = dialog.showAndWait(); logger.fine(" dialog is displayed"); if (!result.isPresent()) return null; return result.get(); }
Example 4
Source File: MediaTableController.java From MyBox with Apache License 2.0 | 6 votes |
@FXML public void addLinkAction() { try { // http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8 TextInputDialog dialog = new TextInputDialog("http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"); dialog.setTitle(message("HTTPLiveStreaming")); dialog.setHeaderText(message("InputAddress")); dialog.setContentText("HLS(.m3u8)"); dialog.getEditor().setPrefWidth(500); Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<String> result = dialog.showAndWait(); if (!result.isPresent()) { return; } String address = result.get(); addLink(address); } catch (Exception e) { logger.error(e.toString()); } }
Example 5
Source File: DownloadController.java From MyBox with Apache License 2.0 | 6 votes |
@FXML protected void plusAction() { try { TextInputDialog dialog = new TextInputDialog("https://"); dialog.setTitle(message("DownloadManage")); dialog.setHeaderText(message("InputAddress")); dialog.setContentText(""); dialog.getEditor().setPrefWidth(500); Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<String> result = dialog.showAndWait(); if (!result.isPresent()) { return; } String address = result.get(); download(address); } catch (Exception e) { logger.error(e.toString()); } }
Example 6
Source File: MyBoxLanguagesController.java From MyBox with Apache License 2.0 | 6 votes |
@FXML public void plusAction() { TextInputDialog dialog = new TextInputDialog(""); dialog.setTitle(message("ManageLanguages")); dialog.setHeaderText(message("InputLangaugeName")); dialog.setContentText(""); dialog.getEditor().setPrefWidth(200); Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<String> result = dialog.showAndWait(); if (!result.isPresent() || result.get().trim().isBlank()) { return; } langName = result.get().trim(); langLabel.setText(langName); loadLanguage(null); }
Example 7
Source File: PCGenFrame.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
@Override public Optional<String> showInputDialog(String title, String message, String initialValue) { GuiAssertions.assertIsNotJavaFXThread(); TextInputDialog dialog = GuiUtility.runOnJavaFXThreadNow(() -> new TextInputDialog(initialValue)); dialog.setTitle(title); dialog.setContentText(message); return GuiUtility.runOnJavaFXThreadNow(dialog::showAndWait); }
Example 8
Source File: Controller.java From uip-pc2 with MIT License | 5 votes |
public void solicitar(ActionEvent actionEvent) { TextInputDialog dialogo = new TextInputDialog("0"); dialogo.setTitle("Solicitud de Datos"); dialogo.setContentText("Ingrese un numero:"); Optional<String> resultado = dialogo.showAndWait(); if (resultado.isPresent()) { System.out.println("Numero: " + resultado.get()); numero = Integer.parseInt(resultado.get()); } }
Example 9
Source File: PCGenFrame.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
@Override public Optional<String> showInputDialog(String title, String message, String initialValue) { GuiAssertions.assertIsNotJavaFXThread(); TextInputDialog dialog = GuiUtility.runOnJavaFXThreadNow(() -> new TextInputDialog(initialValue)); dialog.setTitle(title); dialog.setContentText(message); return GuiUtility.runOnJavaFXThreadNow(dialog::showAndWait); }
Example 10
Source File: NewVitaminWizardController.java From BowlerStudio with GNU General Public License v3.0 | 5 votes |
@FXML void onNewMeasurment(ActionEvent event) { newMeasurmentButton.setDisable(true); TextInputDialog dialog = new TextInputDialog("lengthOfThing"); dialog.setTitle("Add new measurment to "+typeOfVitaminString); dialog.setHeaderText("This measurment will be added to all instances of the vitamin"); dialog.setContentText("New measurment name:"); // Traditional way to get the response value. Optional<String> result = dialog.showAndWait(); // The Java 8 way to get the response value (with lambda expression). result.ifPresent(name -> { TextInputDialog dialog2 = new TextInputDialog("0.0"); dialog2.setTitle("Set value of "+name); dialog2.setHeaderText("This value will be added to all instances of the vitamin"); dialog2.setContentText(name+" = "); // Traditional way to get the response value. Optional<String> result2 = dialog2.showAndWait(); result2.ifPresent(name2 -> { setupKeyValueToTable(name,name2,sizeOfVitaminString); for(String size:Vitamins.listVitaminSizes(typeOfVitaminString)) { Vitamins.getConfiguration(typeOfVitaminString, size).put(name,name2); } }); newMeasurmentButton.setDisable(false); }); }
Example 11
Source File: DialogUtils.java From qiniu with MIT License | 5 votes |
public static String showInputDialog(String header, String content, String defaultValue) { TextInputDialog dialog = new TextInputDialog(defaultValue); dialog.setTitle(QiniuValueConsts.MAIN_TITLE); dialog.setHeaderText(header); dialog.setContentText(content); Optional<String> result = dialog.showAndWait(); return result.orElse(null); }
Example 12
Source File: AppUtils.java From java-ml-projects with Apache License 2.0 | 5 votes |
public static Optional<String> askInputFromUser(String title, String msg) { TextInputDialog dialog = new TextInputDialog(); dialog.setTitle(title); dialog.setHeaderText(null); dialog.setContentText(msg); return dialog.showAndWait(); }
Example 13
Source File: AppUtils.java From java-ml-projects with Apache License 2.0 | 5 votes |
public static Optional<String> askInputFromUser(String title, String msg) { TextInputDialog dialog = new TextInputDialog(); dialog.setTitle(title); dialog.setHeaderText(null); dialog.setContentText(msg); return dialog.showAndWait(); }
Example 14
Source File: CheckListView.java From marathonv5 with Apache License 2.0 | 5 votes |
public void onTextArea() { TextInputDialog input = new TextInputDialog(); input.setTitle("New Textbox"); input.setContentText("Label: "); input.setHeaderText("Please enter text box label."); Optional<String> result = input.showAndWait(); result.ifPresent(name -> { checkListFormNode.addTextArea(name); fireContentChanged(); }); }
Example 15
Source File: CheckListView.java From marathonv5 with Apache License 2.0 | 5 votes |
public void onChecklist() { TextInputDialog input = new TextInputDialog(); input.setTitle("New Checklist Item"); input.setContentText("Label: "); input.setHeaderText("Please enter item label."); Optional<String> result = input.showAndWait(); result.ifPresent(name -> { checkListFormNode.addCheckListItem(name); fireContentChanged(); }); }
Example 16
Source File: CheckListView.java From marathonv5 with Apache License 2.0 | 5 votes |
public void onHeader() { TextInputDialog input = new TextInputDialog(); input.setTitle("New Header"); input.setContentText("Label: "); input.setHeaderText("Please enter header text."); Optional<String> result = input.showAndWait(); result.ifPresent(name -> { checkListFormNode.addHeader(name); fireContentChanged(); }); }
Example 17
Source File: MediaTableController.java From MyBox with Apache License 2.0 | 5 votes |
@FXML @Override public void saveAction() { if (mediaListName == null || mediaListName.isBlank()) { if (tableData.isEmpty()) { tableLabel.setText(""); return; } TextInputDialog dialog = new TextInputDialog(""); dialog.setTitle(message("ManageMediaLists")); dialog.setHeaderText(message("InputMediaListName")); dialog.setContentText(""); dialog.getEditor().setPrefWidth(400); Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<String> result = dialog.showAndWait(); if (!result.isPresent() || result.get().trim().isBlank()) { return; } mediaListName = result.get().trim(); } if (TableMediaList.set(mediaListName, tableData)) { tableLabel.setText(message("MediaList") + ": " + mediaListName); if (parentController != null) { parentController.popSuccessful(); if (parentController instanceof MediaListController) { ((MediaListController) parentController).update(mediaListName); } } } else { if (parentController != null) { parentController.popFailed(); } } }
Example 18
Source File: MediaListController.java From MyBox with Apache License 2.0 | 5 votes |
@FXML @Override public void saveAsAction() { MediaList selected = tableView.getSelectionModel().getSelectedItem(); if (selected == null || selected.getMedias() == null) { return; } TextInputDialog dialog = new TextInputDialog(""); dialog.setTitle(message("ManageMediaLists")); dialog.setHeaderText(message("InputMediaListName")); dialog.setContentText(""); dialog.getEditor().setPrefWidth(400); Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<String> result = dialog.showAndWait(); if (!result.isPresent() || result.get().trim().isBlank()) { return; } String newName = result.get().trim(); for (MediaList list : tableData) { if (list.getName().equals(newName)) { popError(message("AlreadyExisted")); return; } } if (TableMediaList.set(newName, selected.getMedias())) { popSuccessful(); tableData.add(MediaList.create().setName(newName).setMedias(selected.getMedias())); } else { popFailed(); } }
Example 19
Source File: SecurityCertificatesAddController.java From MyBox with Apache License 2.0 | 4 votes |
@FXML @Override public void okAction() { if (certController == null) { return; } if (addressRadio.isSelected()) { if (addressInput.getText().isEmpty()) { popError(message("NotExist")); return; } } else { sourceFile = new File(sourceFileInput.getText()); if (!sourceFile.exists() || !sourceFile.isFile()) { popError(message("NotExist")); return; } } File ksFile = new File(certController.getSourceFileInput().getText()); if (!ksFile.exists() || !ksFile.isFile()) { popError(message("NotExist")); return; } String password = certController.getPasswordInput().getText(); TextInputDialog dialog = new TextInputDialog(""); dialog.setTitle(message("SecurityCertificates")); dialog.setHeaderText(message("Alias")); dialog.setContentText(""); dialog.getEditor().setPrefWidth(300); Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<String> result = dialog.showAndWait(); if (!result.isPresent() || result.get().trim().isBlank()) { return; } final String alias = result.get().trim(); if (!certController.backupKeyStore()) { return; } try { synchronized (this) { if (task != null) { return; } task = new SingletonTask<Void>() { @Override protected boolean handle() { error = null; if (addressRadio.isSelected()) { try { error = NetworkTools.installCertificateByHost( ksFile.getAbsolutePath(), password, addressInput.getText(), alias); } catch (Exception e) { error = e.toString(); } } else if (fileRadio.isSelected()) { try { error = NetworkTools.installCertificateByFile( ksFile.getAbsolutePath(), password, sourceFile, alias); } catch (Exception e) { error = e.toString(); } } return true; } @Override protected void whenSucceeded() { if (error == null) { certController.loadAll(alias); if (saveCloseCheck.isSelected()) { closeStage(); } popSuccessful(); } else { popError(error); } } }; openHandlingStage(task, Modality.WINDOW_MODAL); Thread thread = new Thread(task); thread.setDaemon(true); thread.start(); } } catch (Exception e) { logger.error(e.toString()); } }
Example 20
Source File: SecurityCertificatesBypassController.java From MyBox with Apache License 2.0 | 4 votes |
@FXML @Override public void addAction() { try { TextInputDialog dialog = new TextInputDialog("docs.oracle.com"); dialog.setTitle(message("SSLVerificationByPass")); dialog.setHeaderText(message("InputAddress")); dialog.setContentText(""); dialog.getEditor().setPrefWidth(500); Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<String> result = dialog.showAndWait(); if (!result.isPresent()) { return; } String address = result.get().trim(); if (address.isBlank()) { return; } for (CertificateBypass p : tableData) { if (p.getHost().equals(address)) { return; } } if (TableBrowserBypassSSL.write(address)) { CertificateBypass newdata = TableBrowserBypassSSL.read(address); if (newdata != null) { tableData.add(newdata); tableView.refresh(); popSuccessful(); } else { popFailed(); } } else { popFailed(); } } catch (Exception e) { logger.error(e.toString()); } }