本文整理匯總了Java中javafx.scene.control.Alert.setContentText方法的典型用法代碼示例。如果您正苦於以下問題:Java Alert.setContentText方法的具體用法?Java Alert.setContentText怎麽用?Java Alert.setContentText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.Alert
的用法示例。
在下文中一共展示了Alert.setContentText方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: unarchiveSector
import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
private void unarchiveSector(ActionEvent event) {
try {
sector.unarchiveSector(sectorcmboUnArchive.getValue());
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Message");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText(sectorcmboUnArchive.getValue()+ " is Unarchived Successfully");
Stage SettingsStage = (Stage) btnDashboard.getScene().getWindow();
confirmationMsg.setX(SettingsStage.getX() + 200);
confirmationMsg.setY(SettingsStage.getY() + 170);
confirmationMsg.showAndWait();
tabSectorInitialize();
} catch (Exception e) {}
}
示例2: openPatientHistoryStage
import javafx.scene.control.Alert; //導入方法依賴的package包/類
private void openPatientHistoryStage(Patient patient) {
if (patient.getNumberOfPrescription() == 0) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("There is no prescription");
alert.setHeaderText("History not found");
alert.setContentText("There is no prescription to show");
alert.showAndWait();
} else {
System.out.println("Go on");
FXMLLoader fXMLLoader = new FXMLLoader(getClass().getResource("/view/patient/PatientHistory.fxml"));
try {
Parent root = fXMLLoader.load();
PatientHistoryController controller = fXMLLoader.getController();
controller.setPatient(patient);
Stage stage = new Stage();
stage.initModality(Modality.WINDOW_MODAL);
stage.setTitle(patient.getName() + " History");
stage.setScene(new Scene(root));
stage.show();
} catch (IOException ex) {
Logger.getLogger(PatientsController.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
示例3: onClickPageClose
import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
private void onClickPageClose(ActionEvent event) {
if (this.rootTagElement == null) {
return;
}
final Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Saving?");
alert.setContentText("Do you want to save your latest changes?");
alert.getButtonTypes().clear();
alert.getButtonTypes().addAll(ButtonType.YES, ButtonType.NO, ButtonType.CANCEL);
final ButtonType result = alert.showAndWait().orElse(ButtonType.CANCEL);
if (result == ButtonType.YES) {
save();
}
if (result != ButtonType.CANCEL) {
this.tags_view.setRoot(null);
this.file_save.setDisable(true);
this.rootTagElement = null;
this.openFile = null;
}
}
示例4: handleAbout
import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
private void handleAbout() {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Kanphnia2");
alert.setHeaderText("About");
alert.setContentText("This is a password manager.");
alert.showAndWait();
}
示例5: multipleChoiceAlert
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static Alert multipleChoiceAlert(String header, String message,ButtonType... buttons) {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Confirm action");
alert.setHeaderText(header);
alert.setContentText(message);
alert.getButtonTypes().setAll(buttons);
return alert;
}
示例6: deleteClicked
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public void deleteClicked()
{
if(txtname.getText().equals("") || txtlevel.getText().equals(""))
{
// Nothing selected.
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("No Selection");
alert.setHeaderText("No Person Selected");
alert.setContentText("Please select a person in the table.");
alert.showAndWait();
}
else
{
boolean result = Confirmation.display("Delete Record", " Are you sure you want to delete this \n user? ");
if(result)
{
ObservableList<UserCreation> selectedProd, allProd;
allProd= table.getItems();
selectedProd = table.getSelectionModel().getSelectedItems();
//selectedProd.forEach(allProd:: remove);
//the delete query is now complete ------------------>
String query = "DELETE FROM login where username='" + txtname.getText() + "'";
//connect to database
DBConnect.connect();
try {
DBConnect.stmt.execute(query);
selectedProd.forEach(allProd:: remove);
SuccessMessage.display("Success", "User has been deleted successfully");
DBConnect.closeConnection();
} catch (Exception ea) {
ErrorMessage.display("Launching Error", ea.getMessage()+" Error has occurred. Consult administrator");
}
}
}
}
示例7: showErrorAlert
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static void showErrorAlert(String title, String content) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle(title);
alert.setHeaderText(null);
alert.setContentText(content);
alert.showAndWait();
}
示例8: 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];
}
示例9: deletePrescription
import javafx.scene.control.Alert; //導入方法依賴的package包/類
private void deletePrescription(Prescription prescription) {
if (prescriptionGetway.deletePrescription(prescription)) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Success");
alert.setHeaderText("Prescription has been deleted");
alert.setContentText("Prescription has been deleted successfully");
alert.show();
if (prescriptionDefault) {
loadPrescriptions();
} else {
loadSearchPrescription(tfSearch.getText());
}
}
}
示例10: showSavingErrorAlert
import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
* Displays an error if an error occurred during game saving
*
* @param e The exception to display
*/
protected void showSavingErrorAlert(UnableToWriteSaveException e) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle(this.scrabble.getI18nMessages().getString("error"));
alert.setHeaderText(this.scrabble.getI18nMessages().getString("errorWhileSaving"));
alert.setContentText(this.scrabble.getI18nMessages().getString(e.getMessage()));
alert.showAndWait();
}
示例11: showErrorInvalidPlayersNumber
import javafx.scene.control.Alert; //導入方法依賴的package包/類
protected void showErrorInvalidPlayersNumber() {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle(this.scrabble.getI18nMessages().getString("error"));
alert.setHeaderText(this.scrabble.getI18nMessages().getString("incorrectNumberOfPlayers"));
alert.setContentText(this.scrabble.getI18nMessages().getString("numberOfPlayersMustFitRules"));
alert.showAndWait();
}
示例12: show
import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
* Shows the alert
*/
public void show(){
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.initStyle(style);
alert.setContentText(warning);
alert.setHeaderText(header);
alert.showAndWait();
}
示例13: 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();
}
}
示例14: errorAlert
import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
* Creates an error alert with an expandable section that shows a Java stack trace.
* @param header The alert header message (this is not the dialog title)
* @param message The alert body message
* @param t The Java throwable whose stack trace will appear in the expandable section.
* @return A JavafX error alert
*/
public static Alert errorAlert(String header, String message, Throwable t) {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Error");
alert.setHeaderText(header);
alert.setContentText(message);
if(t != null)
alert.getDialogPane().setExpandableContent(createExpandableContent(t));
return alert;
}
示例15: systembtnWalletBalance
import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
private void systembtnWalletBalance(ActionEvent event) {
Stage SettingsStage = (Stage) btnDashboard.getScene().getWindow();
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Starting Wallet Balance");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Press \"Adjust Balance\" Button");
confirmationMsg.setX(SettingsStage.getX() + 200);
confirmationMsg.setY(SettingsStage.getY() + 170);
(new TabAccess()).setTabName("tabExpense");
(new GoToOperation()).goToMakeATransaction(SettingsStage.getX(), SettingsStage.getY());
confirmationMsg.showAndWait();
SettingsStage.close();
}