javafx.scene.control.Alert#setGraphic ( )源码实例Demo

下面列出了javafx.scene.control.Alert#setGraphic ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: mars-sim   文件: MultiplayerServer.java
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();
}
 
源代码2 项目: markdown-writer-fx   文件: MainWindow.java
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();
}
 
源代码3 项目: ClusterDeviceControlPlatform   文件: MainView.java
@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();
}
 
/**
 * 未绑定设备弹出警告
 */
private void nobindalertdialog() {
    Alert alert = new Alert(Alert.AlertType.INFORMATION);
    alert.setTitle("警告");
    alert.setHeaderText(null);
    alert.setGraphic(null);
    alert.setContentText("未关联相应的设备");
    alert.showAndWait();
}
 
源代码5 项目: phoebus   文件: ChannelInfo.java
@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();
}
 
源代码6 项目: chat-socket   文件: JavaFxMessageBox.java
@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();
}
 
源代码7 项目: gluon-samples   文件: MenuActions.java
@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();
}