本文整理匯總了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();
}
}
示例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();
}
}
}
示例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) {}
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
}
示例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();
}
示例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;
}
示例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);
}
}
示例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();
}
示例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();
}
示例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;
}
}