本文整理匯總了Java中javafx.scene.control.Alert.show方法的典型用法代碼示例。如果您正苦於以下問題:Java Alert.show方法的具體用法?Java Alert.show怎麽用?Java Alert.show使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.Alert
的用法示例。
在下文中一共展示了Alert.show方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: nextLevel
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public void nextLevel(){
if(!(currentLevel == numLevels)){
Alert winAlert = new CustomAlert(AlertType.CONFIRMATION, "You beat the level!");
winAlert.setOnCloseRequest(e -> bus.emit(new GamePauseResumeEvent()));
winAlert.show();
bus.emit(new GamePauseResumeEvent());
///System.out.println("next level loading");
currentLevel++;
//System.out.println("Current level: " + currentLevel);
loadLevel(data.get(currentLevel-1));
return;
}
new WinPresentation().show(new ResultAccessor());;
bus.emit(new WinGameEvent(WinGameEvent.WIN));
bus.emit(new GamePauseResumeEvent());
}
示例2: showDialog
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public void showDialog() {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Feedback Dialog");
alert.setHeaderText("Confirmation of action");
alert.setContentText(message);
alert.show();
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), event -> alert.hide()));
idlestage.setCycleCount(1);
idlestage.play();
}
示例3: handleUpdateButton
import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
private void handleUpdateButton(ActionEvent event) {
if (isValid() && isValidEmail()) {
int showPhone = cbPhone.isSelected() ? 1 : 0;
int showAddress = cbAddress.isSelected() ? 1 : 0;
user.setUserName(tfUserName.getText());
user.setEmailAddress(tfEmail.getText());
user.setFullName(tfFullName.getText());
user.setInfo(taInfo.getText());
user.setAddress(taAddress.getText());
user.setShoePhoneInPrescription(showPhone);
user.setShowAddressInPrescription(showAddress);
if (auth.update(user)) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("User info updated");
alert.setHeaderText("Updated");
alert.setContentText("User info has been updated");
alert.show();
}
}
}
示例4: start
import javafx.scene.control.Alert; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) throws Exception {
if (!Application.check()) {
Alert alert = ComponentUtils.dialog(primaryStage, "", Application.getResource().getString("please.correct.install.maven"));
alert.show();
System.exit(0);
}
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/me/pingcai/Main.fxml"));
loader.setResources(Application.getResource());
Parent root = loader.load();
MainController controller = loader.getController();
controller.setStage(primaryStage);
primaryStage.setResizable(false);
primaryStage.setTitle(Application.getResource().getString("app.name"));
primaryStage.setScene(new Scene(root));
primaryStage.show();
}
示例5: isPasswordsAreMatch
import javafx.scene.control.Alert; //導入方法依賴的package包/類
private boolean isPasswordsAreMatch() {
boolean isValid = false;
if (pfNewPass.getText().matches(pfRePass.getText())) {
isValid = true;
} else {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Given password are not match");
alert.setHeaderText("Your given password age not match");
alert.show();
}
return isValid;
}
示例6: getFont
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static Font getFont(String name) {
if (!Font.getFamilies().contains(name)) {
Alert a = new Alert(AlertType.WARNING);
a.setContentText("Could not find font " + name + ". Defaulting to system font.");
a.show();
}
return Font.font(name);
}
示例7: showNonblock
import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
* Shows the alert, but it isn't always on top
*/
public void showNonblock(){
dialog = new Alert(type);
dialog.setTitle("Alert");
dialog.setContentText(msg);
dialog.setResizable(false);
dialog.initStyle(style);
dialog.show();
}
示例8: isValid
import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
* Check required text field are not empty
*
* @return
*/
private boolean isValid() {
boolean valid = true;
if (tfFullName.getText().isEmpty() || tfEmail.getText().isEmpty() || tfUserName.getText().isEmpty() || taInfo.getText().isEmpty()) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Text Field Required");
alert.setHeaderText("These text field are reuired");
alert.setContentText("User Name \nEmail Address \nFull Name \nInfo");
alert.show();
valid = false;
}
return valid;
}
示例9: btnLoginOnAction
import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
private void btnLoginOnAction(ActionEvent event) {
if (isValid()) {
if (auth.authenticate(tfUserName.getText(), pfPassword.getText())) {
try {
Parent root = FXMLLoader.load(getClass().getResource("/view/Home.fxml"));
root.getStylesheets().add("../css/main.css");
Scene scene = new Scene(root);
Stage stage = new Stage();
stage.setTitle("Dr Assistant (Desktop Edition) - Home");
stage.setScene(scene);
stage.show();
Stage nStage = (Stage) btnLogin.getScene().getWindow();
nStage.close();
} catch (IOException ex) {
Logger.getLogger(LoginController.class.getName()).log(Level.SEVERE, null, ex);
}
} else {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Username or password doesn't match");
alert.setHeaderText("Username or password doesn't match");
alert.show();
}
}
}
示例10: authorize
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public boolean authorize(String authorizationCode) {
try {
GoogleConnector.getInstance().authorize(SecurityService.DEFAULT_ACCOUNT_ID, authorizationCode);
return true;
} catch (IOException e) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setHeaderText("Unexpected error while authenticating into Google.");
alert.setContentText(e.getLocalizedMessage());
alert.show();
return false;
}
}
示例11: save
import javafx.scene.control.Alert; //導入方法依賴的package包/類
private void save() {
try {
OutputStream outputStream = new FileOutputStream(this.openFile);
// Transform the output stream for a specific compression
outputStream = this.rootTagElement.compression.transform(outputStream);
try (NbtTagOutputStream tos = new NbtTagOutputStream(outputStream)) {
tos.write(this.rootTagElement.tag);
}
} catch (IOException e) {
e.printStackTrace();
final Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setContentText("Failed to save the NBT file: " + e.getMessage());
alert.show();
}
}
示例12: 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());
}
}
}
示例13: btnProximoRequisitos_onAction
import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
void btnProximoRequisitos_onAction(ActionEvent event) {
String string = getDadosTabRequisitos();
if (string.length() > 0) {
Alert alerta = new Alert(AlertType.INFORMATION);
alerta.setTitle("AlphaLab");
alerta.setHeaderText("Dados de Requisitos");
alerta.setContentText(string);
alerta.show();
} else {
tabPreencherDados.setDisable(false);
tabRequisitos.setDisable(true);
tabPaneDados.getSelectionModel().select(tabPreencherDados);
cmbDisciplina.requestFocus();
if (hbxHorarios.getChildren().size() > 1)
hbxHorarios.getChildren().remove(1, hbxHorarios.getChildren().size());
hbxHorarios.getChildren().add(buildBoxHorario());
texRequisitos.setText(resources.getString("label.numMaxAlunos") + " " + numMaxAlunos);
if (!listaSoftwaresSelecionados.isEmpty()) {
for (SoftwareEntity software : listaSoftwaresSelecionados) {
vbxSoftwares.getChildren().add(new Text(software.getDescricao()));
}
} else {
vbxSoftwares.getChildren().add(new Text("Nenhum software\nsolicitado!"));
}
// TabPreencherDados
}
}
示例14: showUniqueMessage
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public void showUniqueMessage(Drug drug) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Drug Exist");
alert.setHeaderText(drug.getName() + " Already exist in database");
alert.setContentText("Drug name already exist in database. try another one");
alert.show();
}
示例15: 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();
}