本文整理匯總了Java中javafx.scene.control.Alert.setHeaderText方法的典型用法代碼示例。如果您正苦於以下問題:Java Alert.setHeaderText方法的具體用法?Java Alert.setHeaderText怎麽用?Java Alert.setHeaderText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.Alert
的用法示例。
在下文中一共展示了Alert.setHeaderText方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onSubmitClicked
import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
* Action button for when submit button is clicked.
*
* @throws IOException
*/
public void onSubmitClicked() throws IOException {
if (!feedbackTextArea.getText().isEmpty()
&& !guestEmailTextField.getText().isEmpty()) {
GuestFeedbackService guestfeedbackservice = new GuestFeedbackService();
guestfeedbackservice.createNewGuestFeedback(
new GuestFeedback(feedbackTextArea.getText(), guestEmailTextField.getText())
);
// Display an alert dialog to confirm the submission.
Alert a = new Alert(AlertType.INFORMATION);
a.setTitle("Thanks!");
a.setHeaderText("Thanks for your feedback. As promised, we will now ignore it.");
a.showAndWait();
if (a.getResult() == ButtonType.OK) {
// User clicked OK
onCancelClicked(); // This just closes the dialog, but it's a bit hacky
}
}
}
示例2: alertErrorConfirm
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public int alertErrorConfirm() {
int r = 0;
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("경고");
alert.setHeaderText(null);
alert.setContentText(this.msg);
alert.showAndWait();
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
r = 1;
}
return r;
}
示例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: recusarPedidoReserva
import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
* Mostra uma caixa de di�logo perguntando se o usu�rio realmente deseja
* cancelar a solicita��o de reserva de hor�rio.
*/
private void recusarPedidoReserva() {
Alert alerta = new Alert(Alert.AlertType.CONFIRMATION);
ButtonType sim = new ButtonType("Sim");
ButtonType nao = new ButtonType("N�o");
alerta.setTitle("AlphaLab");
alerta.setHeaderText("Cancelar pedido de Reserva de Hor�rio");
alerta.setContentText("Deseja cancelar o pedido de Reserva de Hor�rio?");
alerta.getButtonTypes().setAll(sim, nao);
alerta.showAndWait().ifPresent(opcao -> {
if (opcao == sim) {
// this.tblRequisitos.getSelectionModel().getSelectedItem().setStatus(Enum.CANCELADA);
}
if (opcao == nao) {
}
});
}
示例5: alertConfirm
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public int alertConfirm() {
int r = 0;
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("확인 알림");
alert.setHeaderText(null);
alert.setContentText(this.msg);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
r = 1;
}
return r;
}
示例6: createAlertDialog
import javafx.scene.control.Alert; //導入方法依賴的package包/類
private void createAlertDialog(DialogObject dialog) {
Alert alert = new Alert(dialog.getType());
alert.setTitle(dialog.getTitle());
alert.setHeaderText(dialog.getHeader());
alert.setContentText(dialog.getContent());
if (dialog.getexception() == null) {
alert.showAndWait();
} else {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
dialog.getexception().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);
alert.getDialogPane().setExpandableContent(expContent);
alert.showAndWait();
}
}
示例7: showRequired
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public void showRequired() {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Validation error");
alert.setHeaderText("Validation error");
alert.setContentText("Patient Name is Required \nPhone Number is Required \nDate or birth is required");
alert.show();
}
示例8: mnuUndo
import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
private void mnuUndo(ActionEvent event) {
Stage HelpStage = (Stage) btnSignOut.getScene().getWindow();
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Action Failed");
alert.setHeaderText("Undo Function Works Only From \"Make A Transaction\" and \"History\" Window");
alert.setContentText("Press \"OK\" to go to \"Make A Transaction\" window");
alert.setX(HelpStage.getX() + 60);
alert.setY(HelpStage.getY() + 170);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK){
(new TabAccess()).setTabName("tabGetMoney"); //name of which Tab should open
(new GoToOperation()).goToMakeATransaction(HelpStage.getX(), HelpStage.getY());
HelpStage.close();
}
}
示例9: showErrorDialog
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static void showErrorDialog (String title, String content) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle(title);
alert.setHeaderText(null);
alert.setContentText(content);
alert.showAndWait();
}
示例10: onActionMenuItemAbout
import javafx.scene.control.Alert; //導入方法依賴的package包/類
@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();
}
示例11: buildAlert
import javafx.scene.control.Alert; //導入方法依賴的package包/類
private void buildAlert(ShowAlert msg, Alert alert) {
alert.getDialogPane().getStylesheets().addAll(toolBox.getStylesheets());
alert.setTitle(msg.getTitle());
alert.setHeaderText(msg.getHeaderText());
alert.setContentText(msg.getContentText());
alert.getDialogPane()
.getStylesheets()
.addAll(toolBox.getStylesheets());
alert.showAndWait();
}
示例12: showExceptionDialog
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static void showExceptionDialog (String title, 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(null);
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();
}
示例13: showConfirmationDialog
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static boolean showConfirmationDialog (String title, String content) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle(title);
alert.setHeaderText(null);
alert.setContentText(content);
Optional<ButtonType> result = alert.showAndWait();
return result.get() == ButtonType.OK;
}
示例14: handleExit
import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
private void handleExit() {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Confirm Exit");
alert.setHeaderText("Exit Kanphnia2?");
alert.setContentText("");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK){
System.exit(0);
} else {
// ... user chose CANCEL or closed the dialog
}
}
示例15: validationButtonClick
import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
public void validationButtonClick(Event evt) {
boolean allGood = true;
int count = 0;
while (count < 6 && allGood == true) {
ComboBox action = choiceBoxes.get(count);
if (action.getValue() != null) {
if (action.getValue().equals("Delegation")) {
ComboBox region = regionBoxes.get(count);
if (region.getValue() == null) {
allGood = false;
}
}
} else {
allGood = false;
}
count++;
}
if (allGood) {
validateAndClose(evt);
} else {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Pas de précipitation !");
alert.setHeaderText(null);
alert.setContentText("Vous devez choisir 6 actions !\nNe pas oublier de choisir la région pour les délégations.");
alert.showAndWait();
}
}