當前位置: 首頁>>代碼示例>>Java>>正文


Java Alert.initOwner方法代碼示例

本文整理匯總了Java中javafx.scene.control.Alert.initOwner方法的典型用法代碼示例。如果您正苦於以下問題:Java Alert.initOwner方法的具體用法?Java Alert.initOwner怎麽用?Java Alert.initOwner使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.control.Alert的用法示例。


在下文中一共展示了Alert.initOwner方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: _showMessageDialog

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static void _showMessageDialog(Window parent, String message, String title, AlertType type, boolean monospace) {
    Alert alert = new Alert(type);
    alert.initOwner(parent);
    alert.setTitle(title);
    alert.setHeaderText(title);
    alert.setContentText(message);
    alert.initModality(Modality.APPLICATION_MODAL);
    alert.setResizable(true);
    if (monospace) {
        Text text = new Text(message);
        alert.getDialogPane().setStyle("-fx-padding: 0 10px 0 10px;");
        text.setStyle(" -fx-font-family: monospace;");
        alert.getDialogPane().contentProperty().set(text);
    }
    alert.showAndWait();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:17,代碼來源:FXUIUtils.java

示例2: newFile

import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
public void newFile() {

    Alert closeConfirmation = new Alert(
            Alert.AlertType.CONFIRMATION,
            "Create a new station?",
            ButtonType.YES,
            ButtonType.NO
    );
    closeConfirmation.setHeaderText("New station");
    closeConfirmation.initModality(Modality.APPLICATION_MODAL);
    closeConfirmation.initOwner(root.getScene().getWindow());

    Optional<ButtonType> closeResponse = closeConfirmation.showAndWait();
    if (ButtonType.YES.equals(closeResponse.get())) {
        station = new Station();
        updateEditors();
        updateTitle();
    }
}
 
開發者ID:rumangerst,項目名稱:CSLMusicModStationCreator,代碼行數:21,代碼來源:MainWindow.java

示例3: showPropertyContainerEditor

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static void showPropertyContainerEditor(Window owner, KlcPropertyContainer propertyContainer, String title,
		String headerText, String contentText) {

	Alert alert = new Alert(AlertType.CONFIRMATION, contentText, ButtonType.OK);
	alert.setTitle(title);
	alert.setHeaderText(headerText);
	alert.initOwner(owner);
	alert.initModality(Modality.WINDOW_MODAL);

	KlcPropertyContainerEditor editor = new KlcPropertyContainerEditor();
	editor.setPrefWidth(300);
	editor.setPrefHeight(200);
	editor.setPropertyContainer(propertyContainer);
	alert.getDialogPane().setContent(editor);

	alert.showAndWait();

}
 
開發者ID:enoy19,項目名稱:keyboard-light-composer,代碼行數:19,代碼來源:DialogUtil.java

示例4: handleEditEntry

import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
private void handleEditEntry() throws Exception {
	Entry selectedEntry = entryTable.getSelectionModel().getSelectedItem();

	if (selectedEntry != null) {
		boolean okClicked = mainApp.showAppEditDialog(selectedEntry);

		if (okClicked) {
			// removed description field
		}
	}
	else {
		Alert alert = new Alert(AlertType.WARNING);
		alert.initOwner(mainApp.getPrimaryStage());
		alert.setTitle("No Selection");
		alert.setHeaderText("No Entry Selected");
		alert.setContentText("Please select an entry in the table.");

		alert.showAndWait();
	}
}
 
開發者ID:yc45,項目名稱:kanphnia2,代碼行數:22,代碼來源:ToDoOverviewController.java

示例5: handleDeleteEntry

import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
private void handleDeleteEntry() {
	int selectedIndex = entryTable.getSelectionModel().getSelectedIndex();

	if (selectedIndex >= 0) {
		entryTable.getItems().remove(selectedIndex);
	}
	else {
		Alert alert = new Alert(AlertType.WARNING);
		alert.initOwner(mainApp.getPrimaryStage());
		alert.setTitle("No Selection");
		alert.setHeaderText("No Entry Selected");
		alert.setContentText("Please select an entry in the table");
		alert.showAndWait();
	}
}
 
開發者ID:yc45,項目名稱:kanphnia2,代碼行數:17,代碼來源:ToDoOverviewController.java

示例6: showThrowable

import javafx.scene.control.Alert; //導入方法依賴的package包/類
/** Show error dialog. **/
static void showThrowable(Window parent, Throwable e) {
	Main.log(e);
	Alert alert = new Alert(Alert.AlertType.ERROR);
	alert.setTitle("Exception");
	alert.initOwner(parent);
	alert.initModality(Modality.WINDOW_MODAL);
	alert.setHeaderText(e.getClass().getName());
	alert.setContentText(e.getMessage());
	StringWriter stringWriter = new StringWriter();
	PrintWriter printWriter = new PrintWriter(stringWriter);
	e.printStackTrace(printWriter);
	String exceptionText = stringWriter.toString();
	TextArea textArea = new TextArea(exceptionText);
	textArea.setEditable(false);
	textArea.setWrapText(true);
	textArea.setMaxWidth(Double.MAX_VALUE);
	textArea.setMaxHeight(Double.MAX_VALUE);
	alert.getDialogPane().setExpandableContent(textArea);
	alert.showAndWait();
}
 
開發者ID:DeskChan,項目名稱:DeskChan,代碼行數:22,代碼來源:App.java

示例7: _showConfirmDialog

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static Optional<ButtonType> _showConfirmDialog(Window parent, String message, String title, AlertType type,
        ButtonType... buttonTypes) {
    Alert alert = new Alert(type, message, buttonTypes);
    alert.initOwner(parent);
    alert.setTitle(title);
    alert.initModality(Modality.APPLICATION_MODAL);
    return alert.showAndWait();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:9,代碼來源:FXUIUtils.java

示例8: getAlert

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static Alert getAlert(String header, String content, AlertType alertType, Modality modality, Window window,
		StageStyle style) {
	Alert alert = new Alert(alertType);

	alert.setTitle(Values.MAIN_TITLE);
	alert.setHeaderText(header);
	alert.setContentText(content);

	alert.initModality(modality);
	alert.initOwner(window);
	alert.initStyle(style);

	return alert;
}
 
開發者ID:zhazhapan,項目名稱:qiniu,代碼行數:15,代碼來源:Dialogs.java

示例9: dialog

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static Alert dialog(Stage stage, String header, String content) {
    Alert alert = new Alert(Alert.AlertType.WARNING);
    alert.initOwner(stage);
    alert.initModality(Modality.WINDOW_MODAL);
    alert.setHeaderText(header);
    alert.setContentText(content);
    return alert;
}
 
開發者ID:pingcai,項目名稱:maven-package-gui-installer,代碼行數:9,代碼來源:ComponentUtils.java

示例10: alertInfoMsg

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public void alertInfoMsg(Stage stage) {

		Alert alert = new Alert(AlertType.INFORMATION);
		alert.setTitle("알림");
		alert.setHeaderText(null);
		alert.setContentText(this.msg);
		alert.initOwner(stage);
		alert.showAndWait();

	}
 
開發者ID:kimyearho,項目名稱:WebtoonDownloadManager,代碼行數:11,代碼來源:AlertSupport.java

示例11: alertErrorMsg

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public void alertErrorMsg(Stage stage) {

		Alert alert = new Alert(AlertType.ERROR);
		alert.initOwner(stage);
		alert.setTitle("Warning Dialog");
		alert.setHeaderText(null);
		alert.setContentText(this.msg);
		alert.showAndWait();

	}
 
開發者ID:kimyearho,項目名稱:WebtoonDownloadManager,代碼行數:11,代碼來源:AlertSupport.java

示例12: alertConfirm

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public int alertConfirm(Stage stage) {
	int r = 0;
	Alert alert = new Alert(AlertType.CONFIRMATION);
	alert.initOwner(stage);
	alert.setTitle("확인 알림");
	alert.setHeaderText(null);
	alert.setContentText(this.msg);

	Optional<ButtonType> result = alert.showAndWait();
	if (result.get() == ButtonType.OK) {
		r = 1;
	}

	return r;
}
 
開發者ID:kimyearho,項目名稱:WebtoonDownloadManager,代碼行數:16,代碼來源:AlertSupport.java

示例13: showErrorDialog

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static void showErrorDialog(Stage owner, String title, String error){
	Alert alert = new Alert(AlertType.ERROR);
	alert.setContentText(error);
	alert.setTitle(title);
	alert.setHeaderText("");
	alert.initOwner(owner);
	alert.showAndWait();
}
 
開發者ID:Flash3388,項目名稱:FlashLib,代碼行數:9,代碼來源:FlashFXUtils.java

示例14: isInputValid

import javafx.scene.control.Alert; //導入方法依賴的package包/類
private boolean isInputValid() {
	String errorMessage = "";

	if ((appTextField.getText() == null) || appTextField.getText().length() == 0) {
		errorMessage += "No valid application!\n";
	}
	if ((usernameTextField.getText() == null) || usernameTextField.getText().length() == 0) {
		errorMessage += "No valid username!\n";
	}
	if ((passwordTextField.getText() == null) || passwordTextField.getText().length() == 0) {
		errorMessage += "No valid password!\n";
	}

	if (errorMessage.length() == 0) {
		return true;
	}
	else {
		Alert alert = new Alert(AlertType.ERROR);
		alert.initOwner(dialogStage);
		alert.setTitle("Invalid Fields");
		alert.setHeaderText("Please correct invalid fields");
		alert.setContentText(errorMessage);

		alert.showAndWait();

		return false;
	}
}
 
開發者ID:yc45,項目名稱:kanphnia2,代碼行數:29,代碼來源:AppEditDialogController.java

示例15: doQuestion

import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
 * Makes a question to the user.
 *
 * @param text
 *            the text
 * @return true, if successful
 */
public static boolean doQuestion(String text , Stage window) {
	boolean[] questionAnswer = { false };
	
	// Show Alert
	Alert alert = new Alert(AlertType.CONFIRMATION);
	alert.initStyle(StageStyle.UTILITY);
	alert.initOwner(window);
	alert.setHeaderText("Question");
	alert.setContentText(text);
	alert.showAndWait().ifPresent(answer -> questionAnswer[0] = ( answer == ButtonType.OK ));
	
	return questionAnswer[0];
}
 
開發者ID:goxr3plus,項目名稱:JavaFXApplicationAutoUpdater,代碼行數:21,代碼來源:ActionTool.java


注:本文中的javafx.scene.control.Alert.initOwner方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。