Java Code Examples for javafx.scene.control.Alert#setGraphic()

The following examples show how to use javafx.scene.control.Alert#setGraphic() . 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: MultiplayerServer.java    From mars-sim with GNU General Public License v3.0 9 votes vote down vote up
public void createAlert(String str) {
	Alert alert = new Alert(AlertType.INFORMATION);
	Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
	// Add corner icon
	stage.getIcons().add(new Image(this.getClass().getResource("/icons/server48.png").toString()));
	// Add Stage icon
	alert.setGraphic(new ImageView(this.getClass().getResource("/icons/server256.png").toString()));
	//alert.initOwner(stage);
	alert.setTitle("Mars Simulation Project");
	alert.setHeaderText("Multiplayer Host");
	//if (mainMenu != null) {
	//   alert.initOwner(mainMenu.getStage());
	//}
	alert.setContentText(str);
	alert.show();
}
 
Example 2
Source File: MainWindow.java    From markdown-writer-fx with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void helpAbout() {
	String version = null;
	Package pkg = this.getClass().getPackage();
	if (pkg != null)
		version = pkg.getImplementationVersion();
	if (version == null)
		version = "(dev)";

	Alert alert = new Alert(AlertType.INFORMATION);
	alert.setTitle(Messages.get("MainWindow.about.title"));
	alert.setHeaderText(Messages.get("MainWindow.about.headerText"));
	alert.setContentText(Messages.get("MainWindow.about.contentText", version));
	alert.setGraphic(new ImageView(new Image("org/markdownwriterfx/markdownwriterfx32.png")));
	alert.initOwner(getScene().getWindow());
	alert.getDialogPane().setPrefWidth(420);

	alert.showAndWait();
}
 
Example 3
Source File: MainView.java    From ClusterDeviceControlPlatform with MIT License 5 votes vote down vote up
@FXML
private void onActionMenuItemAbout(ActionEvent event) {
    Alert alert = new Alert(Alert.AlertType.INFORMATION);
    alert.setTitle("关于");
    alert.setHeaderText("集群设备模拟客户端 " + KySetting.VERSION);
    alert.setGraphic(null);
    alert.setContentText(ViewUtil.getOsInfo());
    alert.showAndWait();
}
 
Example 4
Source File: DeviceCellView.java    From ClusterDeviceControlPlatform with MIT License 5 votes vote down vote up
/**
 * 未绑定设备弹出警告
 */
private void nobindalertdialog() {
    Alert alert = new Alert(Alert.AlertType.INFORMATION);
    alert.setTitle("警告");
    alert.setHeaderText(null);
    alert.setGraphic(null);
    alert.setContentText("未关联相应的设备");
    alert.showAndWait();
}
 
Example 5
Source File: ChannelInfo.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void call(Selection selection) throws Exception
{
    List<ProcessVariable> pvs = new ArrayList<>();
    List<Channel> channels = new ArrayList<>();
    SelectionService.getInstance().getSelection().getSelections().stream().forEach(s -> {
        if (s instanceof Channel)
        {
            channels.add((Channel)s);
        } else if (s instanceof ProcessVariable)
        {
            pvs.add((ProcessVariable) s);
        }
    });

    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(this.getClass().getResource("ui/ChannelInfoTree.fxml"));

    Alert alert = new Alert(INFORMATION);
    alert.setTitle(NAME);
    alert.setHeaderText(null);
    alert.setGraphic(null);
    alert.getDialogPane().setContent(loader.load());

    ChannelInfoTreeController controller = loader.getController();
    controller.setChannels(channels);

    // Query channelfinder for selected pvs on a separate thread.
    pvs.forEach(pv -> {
        ChannelSearchJob.submit(this.client,
                pv.getName(),
                result -> Platform.runLater(() -> {
                    controller.addChannels(result);
                }),
                (url, ex) -> ExceptionDetailsErrorDialog.openError("ChannelFinder Query Error", ex.getMessage(), ex));

    });
    alert.showAndWait();
}
 
Example 6
Source File: JavaFxMessageBox.java    From chat-socket with MIT License 5 votes vote down vote up
@Override
public void show(String caption, String text, MessageType type) {
    Alert alert = new Alert(getAlertType(type));
    URL imageUrl = getUrlByType(type);
    alert.setGraphic(new ImageView(imageUrl != null ? imageUrl.toString() : ""));
    alert.setContentText(getHeaderText(type));
    alert.setTitle(caption);
    alert.setHeaderText(text);
    alert.initStyle(StageStyle.UTILITY);
    alert.showAndWait();
}
 
Example 7
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();
}