Java Code Examples for javafx.scene.control.Alert.AlertType#INFORMATION

The following examples show how to use javafx.scene.control.Alert.AlertType#INFORMATION . 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: SimplePopups.java    From pmd-designer with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public static void showAboutPopup(DesignerRoot root) {
    Alert licenseAlert = new Alert(AlertType.INFORMATION);
    licenseAlert.setWidth(500);
    licenseAlert.setHeaderText("About");

    ScrollPane scroll = new ScrollPane();
    TextArea textArea = new TextArea();

    String sb =
        "PMD core version:\t\t\t" + PMDVersion.VERSION + "\n"
            + "Designer version:\t\t\t" + Designer.getCurrentVersion()
            + " (supports PMD core " + Designer.getPmdCoreMinVersion() + ")\n"
            + "Designer settings dir:\t\t"
            + root.getService(DesignerRoot.DISK_MANAGER).getSettingsDirectory() + "\n"
            + "Available languages:\t\t"
            + AuxLanguageRegistry.getSupportedLanguages().map(Language::getTerseName).collect(Collectors.toList())
            + "\n";

    textArea.setText(sb);
    scroll.setContent(textArea);

    licenseAlert.getDialogPane().setContent(scroll);
    licenseAlert.showAndWait();
}
 
Example 2
Source File: FXMLRaceDetailsController.java    From pikatimer with GNU General Public License v3.0 6 votes vote down vote up
public void deleteWave(ActionEvent fxevent){
    // Make sure the wave is not assigned toanybody first
    final Wave w = waveStartsTableView.getSelectionModel().getSelectedItem();
    
    BooleanProperty inUse = new SimpleBooleanProperty(false);
    
    ParticipantDAO.getInstance().listParticipants().forEach(x ->{
        x.getWaveIDs().forEach(rw -> {
            if (w.getID().equals(rw)) {
                inUse.setValue(Boolean.TRUE);
                //System.out.println("Wave " + w.getWaveName() + " is in use by " + x.fullNameProperty().getValueSafe());
            }
        });
    });
    
    if (inUse.get()) {
        Alert alert = new Alert(AlertType.INFORMATION);
        alert.setTitle("Unable to Remove Wave");
        alert.setHeaderText("Unable to remove the selected wave.");
        alert.setContentText("The wave currently has assigned runners.\nPlease assign them to a different wave before removing.");

        alert.showAndWait();
    } else {
        raceDAO.removeWave(w); 
    }
}
 
Example 3
Source File: IdentifyGraphicsSample.java    From arcgis-runtime-samples-java with Apache License 2.0 6 votes vote down vote up
/**
 * Indicates when a graphic is clicked by showing an Alert.
 */
private void createGraphicDialog() {

  try {
    // get the list of graphics returned by identify
    IdentifyGraphicsOverlayResult result = identifyGraphics.get();
    List<Graphic> graphics = result.getGraphics();

    if (!graphics.isEmpty()) {
      // show a alert dialog box if a graphic was returned
      Alert dialog = new Alert(AlertType.INFORMATION);
      dialog.initOwner(mapView.getScene().getWindow());
      dialog.setHeaderText(null);
      dialog.setTitle("Information Dialog Sample");
      dialog.setContentText("Clicked on " + graphics.size() + " graphic");
      dialog.showAndWait();
    }
  } catch (Exception e) {
    // on any error, display the stack trace
    e.printStackTrace();
  }
}
 
Example 4
Source File: MenuController.java    From zest-writer with GNU General Public License v3.0 6 votes vote down vote up
@FXML private void handleExportMarkdownButtonAction(ActionEvent event){
    Content content = mainApp.getContent();
    DirectoryChooser fileChooser = new DirectoryChooser();
    fileChooser.setInitialDirectory(MainApp.getDefaultHome());
    fileChooser.setTitle(Configuration.getBundle().getString("ui.dialog.export.dir.title"));
    File selectedDirectory = fileChooser.showDialog(MainApp.getPrimaryStage());
    File selectedFile = new File(selectedDirectory, ZdsHttp.toSlug(content.getTitle()) + ".md");
    log.debug("Tentative d'export vers le fichier " + selectedFile.getAbsolutePath());

    if(selectedDirectory != null){

        content.saveToMarkdown(selectedFile);
        log.debug("Export réussi vers " + selectedFile.getAbsolutePath());

        Alert alert = new CustomAlert(AlertType.INFORMATION);
        alert.setTitle(Configuration.getBundle().getString("ui.dialog.export.success.title"));
        alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.export.success.header"));
        alert.setContentText(Configuration.getBundle().getString("ui.dialog.export.success.text")+" \"" + selectedFile.getAbsolutePath() + "\"");
        alert.setResizable(true);

        alert.showAndWait();
    }
}
 
Example 5
Source File: DockItem.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/** Show info dialog */
private void showInfo()
{
    final Alert dlg = new Alert(AlertType.INFORMATION);
    dlg.setTitle(Messages.DockInfo);

    // No DialogPane 'header', all info is in the 'content'
    dlg.setHeaderText("");

    final StringBuilder info = new StringBuilder();
    fillInformation(info);
    final TextArea content = new TextArea(info.toString());
    content.setEditable(false);
    content.setPrefSize(300, 100);
    content.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    dlg.getDialogPane().setContent(content);

    DialogHelper.positionDialog(dlg, name_tab, 0, 0);
    dlg.setResizable(true);
    dlg.showAndWait();
}
 
Example 6
Source File: MainViewImpl.java    From oim-fx with MIT License 5 votes vote down vote up
protected Alert createAlert() {

		Alert alert = new Alert(AlertType.INFORMATION, "");
		alert.initModality(Modality.APPLICATION_MODAL);
		alert.initOwner(mainFrame);
		alert.getDialogPane().setContentText("你的帐号在其他的地方登录!");
		alert.getDialogPane().setHeaderText(null);

		return alert;
	}
 
Example 7
Source File: GitFxDialog.java    From GitFx with Apache License 2.0 5 votes vote down vote up
@Override
public String gitFxInformationListDialog(String title, String header, String label,List list){
    Alert alert = new Alert(AlertType.INFORMATION);
    alert.setTitle(title);
    alert.setHeaderText(header);
    alert.setContentText(label);
    ListView<String> listView = new ListView<>();
    listView.setItems(FXCollections.observableArrayList(list));
    alert.getDialogPane().setContent(listView);
    alert.showAndWait();
    //TODO Need to return the logged newValue for further JGit code to sync
    //a repository
    return null ;
}
 
Example 8
Source File: FileChooserSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private void openFile(List<File> list) {
    Alert alert = new Alert(AlertType.INFORMATION);
    if (list != null) {
        alert.setTitle("Selected file/folder");
        alert.setContentText(list.toString());
    } else {
        alert.setTitle("No file/folder selected");
        alert.setContentText("NO FILES");
    }
    alert.showAndWait();
}
 
Example 9
Source File: MenuActions.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@ActionProxy(text="About",
        graphic="font>github-octicons|MARK_GITHUB",
        accelerator="ctrl+A")
private void about() {
    Alert alert = new Alert(AlertType.INFORMATION);
    alert.setTitle("CodeVault");
    alert.setHeaderText("About CodeVault");
    alert.setGraphic(new ImageView(new Image(MenuActions.class.getResource("/icon.png").toExternalForm(), 48, 48, true, true)));
    alert.setContentText("This is a Gluon Desktop Application that creates a simple Git Repository");
    alert.showAndWait();
}
 
Example 10
Source File: UpdateApplication.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
private void restart(final Node node)
{
    final String message =
            "The application will now exit,\n" +
            "so you can then start the updated version\n";
    final Alert prompt = new Alert(AlertType.INFORMATION,
                                   message,
                                   ButtonType.OK);
    prompt.setTitle(NAME);
    prompt.setHeaderText("Update completed");
    DialogHelper.positionDialog(prompt, node, -400, -250);
    prompt.showAndWait();
    System.exit(0);
}
 
Example 11
Source File: MainViewImpl.java    From oim-fx with MIT License 5 votes vote down vote up
protected Alert createAlert() {
	Alert alert = new Alert(AlertType.INFORMATION, "");
	alert.initModality(Modality.APPLICATION_MODAL);
	alert.initOwner(mainStage);
	alert.getDialogPane().setContentText("你的帐号在其他的地方登录!");
	alert.getDialogPane().setHeaderText(null);
	return alert;
}
 
Example 12
Source File: MultiplayerClient.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public void createAlert(String header, String content) {
	alert = new Alert(AlertType.INFORMATION);
	alert.initModality(Modality.NONE);
	alert.setTitle("Mars Simulation Project");
	// alert.initOwner(mainMenu.getStage());
	alert.setHeaderText("Multiplayer Client");
	alert.setContentText(content); // "Connection verified with " + address
	alert.show();
}
 
Example 13
Source File: DialogLoggerUtil.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * shows a message dialog just for a few given milliseconds
 *
 * @param parent
 * @param title
 * @param message
 * @param time
 */
public static void showMessageDialogForTime(String title, String message, long time) {
  Alert alert = new Alert(AlertType.INFORMATION, message);
  alert.setTitle(title);
  alert.show();
  Timeline idleTimer = new Timeline(new KeyFrame(Duration.millis(time), e -> alert.hide()));
  idleTimer.setCycleCount(1);
  idleTimer.play();
}
 
Example 14
Source File: ConnectionManager.java    From BowlerStudio with GNU General Public License v3.0 5 votes vote down vote up
public static BowlerAbstractDevice pickConnectedDevice(@SuppressWarnings("rawtypes") Class class1) {
	List<String> choices = DeviceManager.listConnectedDevice(class1);
	
	if(!choices.isEmpty()){
		ChoiceDialog<String> dialog = new ChoiceDialog<>(choices.get(0),
				choices);
		dialog.setTitle("Bowler Device Chooser");
		dialog.setHeaderText("Choose connected bowler device");
		dialog.setContentText("Device Name:");

		// Traditional way to get the response value.
		Optional<String> result = dialog.showAndWait();
		if (result.isPresent()) {
			for (int i = 0; i < plugins.size(); i++) {
				if (plugins.get(i).getManager().getName().contains(result.get())) {
					return plugins.get(i).getManager().getDevice();
				}
			}
		}
	}else{
		Alert alert = new Alert(AlertType.INFORMATION);
		alert.setTitle("Device not availible");
		alert.setHeaderText("Connect a "+class1.getSimpleName());
		alert.setContentText("A device of type "+class1.getSimpleName()+" is needed");
		alert .initModality(Modality.APPLICATION_MODAL);
		alert.show();
	}
	return null;
}
 
Example 15
Source File: EditorFrame.java    From JetUML with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Copies the current image to the clipboard.
 */
public void copyToClipboard() 
{
	DiagramTab frame = getSelectedDiagramTab();
	final Image image = ImageCreator.createImage(frame.getDiagram());
	final Clipboard clipboard = Clipboard.getSystemClipboard();
    final ClipboardContent content = new ClipboardContent();
    content.putImage(image);
    clipboard.setContent(content);
	Alert alert = new Alert(AlertType.INFORMATION, RESOURCES.getString("dialog.to_clipboard.message"), ButtonType.OK);
	alert.initOwner(aMainStage);
	alert.setHeaderText(RESOURCES.getString("dialog.to_clipboard.title"));
	alert.showAndWait();
}
 
Example 16
Source File: SimplePopups.java    From pmd-designer with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void showLicensePopup() {
    Alert licenseAlert = new Alert(AlertType.INFORMATION);
    licenseAlert.setWidth(500);
    licenseAlert.setHeaderText("License");

    ScrollPane scroll = new ScrollPane();
    try {
        scroll.setContent(new TextArea(IOUtils.toString(SimplePopups.class.getResourceAsStream(LICENSE_FILE_PATH), StandardCharsets.UTF_8)));
    } catch (IOException e) {
        e.printStackTrace();
    }

    licenseAlert.getDialogPane().setContent(scroll);
    licenseAlert.showAndWait();
}
 
Example 17
Source File: UpdateApplication.java    From phoebus with Eclipse Public License 1.0 4 votes vote down vote up
private void promptForUpdate(final Node node, final Instant new_version)
{
    final File install_location = Locations.install();
    // Want to  update install_location, but that's locked on Windows,
    // and replacing the jars of a running application might be bad.
    // So download into a stage area.
    // The start script needs to be aware of this stage area
    // and move it to the install location on startup.
    final File stage_area = new File(install_location, "update");
    final StringBuilder buf = new StringBuilder();
    buf.append("You are running version  ")
       .append(TimestampFormats.DATETIME_FORMAT.format(Update.current_version))
       .append("\n")
       .append("The new version is dated ")
       .append(TimestampFormats.DATETIME_FORMAT.format(new_version))
       .append("\n\n")
       .append("The update will replace the installation in\n")
       .append(install_location)
       .append("\n(").append(stage_area).append(")")
       .append("\nwith the content of ")
       .append(Update.update_url)
       .append("\n\n")
       .append("Do you want to update?\n");

    final Alert prompt = new Alert(AlertType.INFORMATION,
                                   buf.toString(),
                                   ButtonType.OK, ButtonType.CANCEL);
    prompt.setTitle(NAME);
    prompt.setHeaderText("A new version of this software is available");
    prompt.setResizable(true);
    DialogHelper.positionDialog(prompt, node, -600, -350);
    prompt.getDialogPane().setPrefSize(600, 300);
    if (prompt.showAndWait().orElse(ButtonType.CANCEL) == ButtonType.OK)
    {
        // Show job manager to display progress
        ApplicationService.findApplication(JobViewerApplication.NAME).create();
        // Perform update
        JobManager.schedule(NAME, monitor ->
        {
            Update.downloadAndUpdate(monitor, stage_area);
            Update.adjustCurrentVersion();
            if (! monitor.isCanceled())
                Platform.runLater(() -> restart(node));
        });
    }
    else
    {
        // Remove the update button
        StatusBar.getInstance().removeItem(start_update);
        start_update = null;
    }
}
 
Example 18
Source File: OpenAbout.java    From phoebus with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Void call()
{
    dialog = new Alert(AlertType.INFORMATION);
    dialog.setTitle(Messages.HelpAboutTitle);
    dialog.setHeaderText(Messages.HelpAboutHdr);

    // Table with Name, Value columns
    final ObservableList<List<String>> infos = FXCollections.observableArrayList();
    // Start with most user-specific to most generic: User location, install, JDK, ...
    // Note that OpenFileBrowserCell is hard-coded to add a "..." button for the first few rows.
    infos.add(Arrays.asList(Messages.HelpAboutUser, Locations.user().toString()));
    infos.add(Arrays.asList(Messages.HelpAboutInst, Locations.install().toString()));
    infos.add(Arrays.asList(Messages.HelpAboutUserDir, System.getProperty("user.dir")));
    infos.add(Arrays.asList(Messages.HelpJavaHome, System.getProperty("java.home")));
    infos.add(Arrays.asList(Messages.AppVersionHeader, Messages.AppVersion));
    infos.add(Arrays.asList(Messages.HelpAboutJava, System.getProperty("java.specification.vendor") + " " + System.getProperty("java.runtime.version")));
    infos.add(Arrays.asList(Messages.HelpAboutJfx, System.getProperty("javafx.runtime.version")));
    infos.add(Arrays.asList(Messages.HelpAboutPID, Long.toString(ProcessHandle.current().pid())));

    // Display in TableView
    final TableView<List<String>> info_table = new TableView<>(infos);
    info_table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    info_table.setPrefHeight(290.0);

    final TableColumn<List<String>, String> name_col = new TableColumn<>(Messages.HelpAboutColName);
    name_col.setCellValueFactory(cell -> new SimpleStringProperty(cell.getValue().get(0)));
    info_table.getColumns().add(name_col);

    final TableColumn<List<String>, String> value_col = new TableColumn<>(Messages.HelpAboutColValue);
    value_col.setCellValueFactory(cell -> new SimpleStringProperty(cell.getValue().get(1)));
    value_col.setCellFactory(col -> new ReadOnlyTextCell<>());
    info_table.getColumns().add(value_col);

    final TableColumn<List<String>, String> link_col = new TableColumn<>();
    link_col.setMinWidth(50);
    link_col.setMaxWidth(50);
    link_col.setCellValueFactory(cell -> new SimpleStringProperty(cell.getValue().get(1)));
    link_col.setCellFactory(col ->  new OpenFileBrowserCell());
    info_table.getColumns().add(link_col);

    dialog.getDialogPane().setContent(info_table);

    // Info for expandable "Show Details" section
    dialog.getDialogPane().setExpandableContent(createDetailSection());

    dialog.setResizable(true);
    dialog.getDialogPane().setPrefWidth(800);
    DialogHelper.positionDialog(dialog, DockPane.getActiveDockPane(), -400, -300);

    dialog.showAndWait();
    // Indicate that dialog is closed; allow GC
    dialog = null;

    return null;
}
 
Example 19
Source File: DialogLoggerUtil.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
public static void showMessageDialog(String title, String message) {
  Alert alert = new Alert(AlertType.INFORMATION, message);
  alert.setTitle(title);
  alert.showAndWait();
}
 
Example 20
Source File: Main.java    From ShootOFF with GNU General Public License v3.0 4 votes vote down vote up
private boolean showFirstRunMessage() {
	final Label hardwareMessageLabel = new Label("Fetching hardware status to determine how well ShootOFF\n"
			+ "will run on this machine. This may take a moment...");

	new Thread(() -> {
		final String cpuName = HardwareData.getCpuName();
		final Optional<Integer> cpuScore = HardwareData.getCpuScore();
		final long installedRam = HardwareData.getMegabytesOfRam();

		if (cpuScore.isPresent()) {
			if (logger.isDebugEnabled()) logger.debug("Processor: {}, Processor Score: {}, installed RAM: {} MB",
					cpuName, cpuScore.get(), installedRam);

			Platform.runLater(() -> setHardwareMessage(hardwareMessageLabel, cpuScore.get()));
		} else {
			if (logger.isDebugEnabled()) logger.debug("Processor: {}, installed RAM: {} MB", cpuName, installedRam);

			Platform.runLater(() -> setHardwareMessage(hardwareMessageLabel, installedRam));
		}
	}).start();

	final Alert shootoffWelcome = new Alert(AlertType.INFORMATION);
	shootoffWelcome.setTitle("Welcome to ShootOFF");
	shootoffWelcome.setHeaderText("Please Ensure Your Firearm is Unloaded!");
	shootoffWelcome.setResizable(true);

	final FlowPane fp = new FlowPane();
	final Label lbl = new Label("Thank you for choosing ShootOFF for your training needs.\n"
			+ "Please be careful to ensure your firearm is not loaded\n"
			+ "every time you use ShootOFF. We are not liable for any\n"
			+ "negligent discharges that may result from your use of this\n" + "software.\n\n"
			+ "We upload most errors that cause crashes to our servers to\n"
			+ "help us detect and fix common problems. We do not include any\n"
			+ "personal information in these reports, but you may uncheck\n"
			+ "the box below if you do not want to support this effort.\n\n");
	final CheckBox useErrorReporting = new CheckBox("Allow ShootOFF to Send Error Reports");
	useErrorReporting.setSelected(true);

	fp.getChildren().addAll(hardwareMessageLabel, lbl, useErrorReporting);

	shootoffWelcome.getDialogPane().contentProperty().set(fp);
	shootoffWelcome.showAndWait();

	return useErrorReporting.isSelected();
}