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


Java Alert.setTitle方法代碼示例

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


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

示例1: saveEntryDataToFile

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public void saveEntryDataToFile(File f) {
	try {
		JAXBContext context = JAXBContext.newInstance(EntryListWrapper.class);
		Marshaller m = context.createMarshaller();
		m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
		
		// wrapping the entry data
		EntryListWrapper wrapper = new EntryListWrapper();
		wrapper.setEntries(entryList);
		
		// marshalling and saving xml to file
		m.marshal(wrapper, f);
		
		// save file path
		setFilePath(f);
	}
	catch (Exception e) {
		Alert alert = new Alert(AlertType.ERROR);
		alert.setTitle("Error");
		alert.setHeaderText("Could not save data");
		alert.setContentText("Could not save data to file:\n" + f.getPath());
		
		alert.showAndWait();
	}
}
 
開發者ID:yc45,項目名稱:kanphnia2,代碼行數:26,代碼來源:MainApp.java

示例2: saveOnExit

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public void saveOnExit() {
    if (!taNoteText.getText().equals(this.note.getText())) {
        if (!JGMRConfig.getInstance().isDontAskMeToSave()) {
            Alert alert = new Alert(AlertType.CONFIRMATION);
            alert.setTitle("Save notes?");
            alert.setHeaderText("Would you like to save your notes?");
            ButtonType save = new ButtonType("Save");
            ButtonType dontaskmeagain = new ButtonType("Don't ask me again");
            ButtonType dontsave = new ButtonType("Don't save", ButtonData.CANCEL_CLOSE);
            alert.getButtonTypes().setAll(save, dontaskmeagain, dontsave);
            Optional<ButtonType> result = alert.showAndWait();
            if(result.get() == save){
                save();
            }else if(result.get() == dontaskmeagain){
                JGMRConfig.getInstance().setDontAskMeToSave(true);
                save();
            }
            
        } else {
            save();
        }
    }
}
 
開發者ID:eternia16,項目名稱:javaGMR,代碼行數:24,代碼來源:TexteditorController.java

示例3: archiveSource

import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
private void archiveSource(ActionEvent event) {
	try {
		source.archiveSource(sourcecmboArchive.getValue());
		
		Alert confirmationMsg = new Alert(AlertType.INFORMATION);
		confirmationMsg.setTitle("Message");
		confirmationMsg.setHeaderText(null);
		confirmationMsg.setContentText(sourcecmboArchive.getValue()+ " is Archived Successfully");
		Stage SettingsStage = (Stage) btnDashboard.getScene().getWindow();
		confirmationMsg.setX(SettingsStage.getX() + 200);
		confirmationMsg.setY(SettingsStage.getY() + 170);
		confirmationMsg.showAndWait();
		
		tabSourceInitialize();
	} catch (Exception e) {}
}
 
開發者ID:krHasan,項目名稱:Money-Manager,代碼行數:18,代碼來源:SettingsController.java

示例4: _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

示例5: newAlert

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static Alert newAlert(AlertType type, String title, String mainText, String details) {
	Alert result = new Alert(type);

	result.setTitle(title);
	result.setHeaderText(mainText);
	result.setContentText(details);

	return result;
}
 
開發者ID:ScreachFr,項目名稱:titanium,代碼行數:10,代碼來源:ErrorUtils.java

示例6: showNoMoreRoomsInCategoryErrorDialog

import javafx.scene.control.Alert; //導入方法依賴的package包/類
private void showNoMoreRoomsInCategoryErrorDialog() {
    Alert errorDialog = new Alert(Alert.AlertType.ERROR);
        errorDialog.setTitle("Error");
        errorDialog.setHeaderText("Error Placing Booking");
        errorDialog.setContentText("We were unable to place your booking because there"
                + " were not enough rooms of the type you requested available. "
                + "This can happen if somebody else booked the rooms you were trying to"
                + " before you completed your booking."
                + "\n Please return to the previous screen and try again.");
        errorDialog.showAndWait();
}
 
開發者ID:maillouxc,項目名稱:git-rekt,代碼行數:12,代碼來源:PlaceBookingScreenController.java

示例7: mnuUndo

import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
private void mnuUndo(ActionEvent event) {
	String feedback = new Undo().actionUndo();
	Stage TransactionHistoryStage = (Stage) btnSignOut.getScene().getWindow();
	Alert alert = new Alert(AlertType.INFORMATION);
	alert.setTitle("Action Successful");
	alert.setHeaderText(null);
	alert.setContentText(feedback);
	alert.setX(TransactionHistoryStage.getX() + 190);
	alert.setY(TransactionHistoryStage.getY() + 190);
	initialize();
	alert.showAndWait();
}
 
開發者ID:krHasan,項目名稱:Money-Manager,代碼行數:14,代碼來源:TransactionHistoryController.java

示例8: showExceptionDialog

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static void showExceptionDialog (String title, String headerText, String content, Throwable e) {
    //Source: http://code.makery.ch/blog/javafx-dialogs-official/

    Alert alert = new Alert(Alert.AlertType.ERROR);
    alert.setTitle(title);
    alert.setHeaderText(headerText);
    alert.setContentText(content);

    // Create expandable Exception.
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    e.printStackTrace(pw);
    String exceptionText = sw.toString();

    Label label = new Label("The exception stacktrace was:");

    TextArea textArea = new TextArea(exceptionText);
    textArea.setEditable(false);
    textArea.setWrapText(true);

    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(textArea, Priority.ALWAYS);
    GridPane.setHgrow(textArea, Priority.ALWAYS);

    GridPane expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(textArea, 0, 1);

    //set expandable Exception into the dialog pane.
    alert.getDialogPane().setExpandableContent(expContent);

    alert.showAndWait();
}
 
開發者ID:open-erp-systems,項目名稱:erp-frontend,代碼行數:36,代碼來源:JavaFXUtils.java

示例9: deleteDrug

import javafx.scene.control.Alert; //導入方法依賴的package包/類
private void deleteDrug(int drugId, String name) {
    Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
    alert.setTitle("Delete patient ?");
    alert.setHeaderText("Delete " + name + " ?");
    alert.setContentText("Are you sure to delete this drug ?");
    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == ButtonType.OK) {
        drugGetway.delete(drugId);
        loadDrugs();
    }
}
 
開發者ID:kmrifat,項目名稱:Dr-Assistant,代碼行數:12,代碼來源:DrugsController.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: isCurrentPassMatch

import javafx.scene.control.Alert; //導入方法依賴的package包/類
private boolean isCurrentPassMatch() {
    boolean isValid = false;
    if (user.getPassword().matches(pfCurrent.getText())) {
        isValid = true;
    } else {
        Alert alert = new Alert(Alert.AlertType.ERROR);
        alert.setTitle("Current password not match");
        alert.setHeaderText("Current password not match");
        alert.show();
    }
    return isValid;
}
 
開發者ID:kmrifat,項目名稱:Dr-Assistant,代碼行數:13,代碼來源:ChangePasswordController.java

示例12: delValue

import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
 * 刪除值.
 *
 * @param key 數據庫中的鍵
 */
@Override
public void delValue(String key, boolean selected) {
    Alert confirmAlert = MyAlert.getInstance(Alert.AlertType.CONFIRMATION);
    confirmAlert.setTitle("提示");
    confirmAlert.setHeaderText("");
    confirmAlert.setContentText("將隨機刪除一個值");
    Optional<ButtonType> opt = confirmAlert.showAndWait();
    ButtonType rtn = opt.get();
    if (rtn == ButtonType.OK) {
        // 確定
        redisSet.pop(key);
    }
}
 
開發者ID:Kuangcp,項目名稱:MythRedisClient,代碼行數:19,代碼來源:SetAction.java

示例13: displayAlert

import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
  * Displays and alert window if the there was an error updating books 
  * avaliable copies.
  * @param type type of alert to display
  * @param title the title of the alert window
  * @param messageHeader the message on the alert window
  * @param errorCode the error code to be displayed if multiple avaliable.
  */
private void displayAlert(Alert.AlertType type, String title, 
         String messageHeader, String errorCode) 
 {
     Alert alert = new Alert(type);
     alert.setTitle(title);
     alert.setContentText(messageHeader);
     alert.setHeaderText(null);
     Stage stage5 = (Stage) alert.getDialogPane().getScene().getWindow();
     stage5.getIcons().add(new Image("images/emptySpace.png"));
     alert.setGraphic(new ImageView(("images/emptySpace.png")));
     alert.showAndWait();
 }
 
開發者ID:pxndroid,項目名稱:mountieLibrary,代碼行數:21,代碼來源:Books.java

示例14: displayBookingHasAlreadyBeenCheckedInError

import javafx.scene.control.Alert; //導入方法依賴的package包/類
private void displayBookingHasAlreadyBeenCheckedInError() {
    Alert errorDialog = new Alert(AlertType.ERROR);
    errorDialog.setTitle("Error");
    errorDialog.setHeaderText("Cannot check in the selected booking");
    errorDialog.setContentText("This booking has already been checked in previously");
    errorDialog.showAndWait();
}
 
開發者ID:maillouxc,項目名稱:git-rekt,代碼行數:8,代碼來源:GuestRegistryScreenController.java

示例15: showConfirmation

import javafx.scene.control.Alert; //導入方法依賴的package包/類
private static void showConfirmation(String text){
	Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
	try {
		((Stage) alert.getDialogPane().getScene().getWindow()).setAlwaysOnTop(true);
	} catch (Exception e){ }
	alert.setTitle(Main.getString("default_messagebox_name"));
	alert.setContentText(Main.getString(text));
	Optional<ButtonType> result = alert.showAndWait();
	if(result.get() != ButtonType.OK){
		return;
	}
}
 
開發者ID:DeskChan,項目名稱:DeskChan,代碼行數:13,代碼來源:OverlayStage.java


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