当前位置: 首页>>代码示例>>Java>>正文


Java AlertType.ERROR属性代码示例

本文整理汇总了Java中javafx.scene.control.Alert.AlertType.ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java AlertType.ERROR属性的具体用法?Java AlertType.ERROR怎么用?Java AlertType.ERROR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javafx.scene.control.Alert.AlertType的用法示例。


在下文中一共展示了AlertType.ERROR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: editWSPAction

private void editWSPAction(Event e) {
	EditWSPDialog dialog = new EditWSPDialog(wsp);
	Optional<WebServiceProvider> result = dialog.showAndWait();

	if (result.isPresent()) {
		try {
			wsp = result.get();
			wsp.fetchConfiguration();
			writeWSP(wsp);
		} catch (JSONException | WebApiException | IOException | HttpException e1) {
			Alert a = ErrorUtils.getAlertFromException(e1);
			a.show();
			e1.printStackTrace();
		}
		
	} else {
		new Alert(AlertType.ERROR, "Wrong WSP information");
	}
}
 
开发者ID:ScreachFr,项目名称:titanium,代码行数:19,代码来源:MainPane.java

示例2: showAlertDialogue

/**
 * Spawns an error dialogue detailing the given exception.
 * <p>
 * The given message will be used as the dialogue's header, and the exception's stack
 * trace will appear in the hidden "more information" dropdown.
 * <p>
 * If the exception has a message, it will be displayed in the dialogue's content
 * field, prefaced by "Cause:"
 * 
 * @param exception
 *            The exception to display
 * @param message
 *            A message to describe the context of the dialogue, usually why the
 *            dialogue is appearing (e.g. "An error has occurred!")
 */
public static void showAlertDialogue(Exception exception, String message)
{
	String context = exception.getMessage();
	boolean valid = (context != null && !context.isEmpty());
	context = (valid) ? "Cause: " + context : null;
	
	Alert alert = new Alert(AlertType.ERROR);
	alert.setTitle("Exception Dialog");
	alert.setHeaderText(message);
	alert.setContentText(context);
	alert.setGraphic(null);
	
	String exceptionText = getStackTraceAsString(exception);
	TextArea textArea = new TextArea(exceptionText);
	textArea.setEditable(false);
	textArea.setWrapText(false);
	
	alert.getDialogPane().setExpandableContent(textArea);
	alert.showAndWait();
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:35,代码来源:Dialogues.java

示例3: alertErrorConfirm

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;

	}
 
开发者ID:kimyearho,项目名称:WebtoonDownloadManager,代码行数:18,代码来源:AlertSupport.java

示例4: saveEntryDataToFile

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,代码行数:25,代码来源:MainApp.java

示例5: removeServerAction

private void removeServerAction(Event e) {
	Alert conf = new Alert(AlertType.CONFIRMATION, "Do you really want to remove this server ?");

	Optional<ButtonType> result = conf.showAndWait();

	if (result.isPresent() && result.get().equals(ButtonType.OK)) {
		Server s = content.removeSelectedServer();
		if (s != null) {
			servers.remove(s);
			ServerListLoader.writeServerList(servers);
		} else
			new Alert(AlertType.ERROR, "No selected server");

	}
}
 
开发者ID:ScreachFr,项目名称:titanium,代码行数:15,代码来源:MainPane.java

示例6: displayBookingHasAlreadyBeenCheckedInError

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,代码行数:7,代码来源:GuestRegistryScreenController.java

示例7: errorAlert

/**
 * 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;
}
 
开发者ID:vibridi,项目名称:fxutils,代码行数:17,代码来源:FXDialog.java

示例8: error

private static void error(String title, String text) {
	Alert alert = new Alert(AlertType.ERROR);
	setIcon(alert);
	alert.setTitle(title);
	alert.setContentText(text);

	alert.showAndWait();
}
 
开发者ID:zeobviouslyfakeacc,项目名称:ModLoaderInstaller,代码行数:8,代码来源:MainPanel.java

示例9: ensureRequiredFieldsNotEmpty

private boolean ensureRequiredFieldsNotEmpty() {
    // Gather trimmed form data from all required fields.
    String firstName = firstNameField.getText().trim();
    String lastName = lastNameField.getText().trim();
    String addressLine1 = addressLine1Field.getText().trim();
    String city = cityField.getText().trim();
    String country = countryPicker.getValue();
    String postalCode = postalCodeField.getText().trim();

    boolean requiredFieldsNotEmpty = true; // Innocent until proven guilty

    // Check if required fields are empty
    if(firstName.isEmpty()
            || lastName.isEmpty()
            || addressLine1.isEmpty()
            || city.isEmpty()
            || country.isEmpty()
            || postalCode.isEmpty()) {
        requiredFieldsNotEmpty = false;
    }

    if(requiredFieldsNotEmpty==false) {
        Alert alert = new Alert(AlertType.ERROR);
        alert.setTitle("Error");
        alert.setHeaderText("Missing Required Fields");
        alert.setContentText("Please ensure all fields are filled.");
        alert.showAndWait();
    }

    return requiredFieldsNotEmpty;
}
 
开发者ID:maillouxc,项目名称:git-rekt,代码行数:31,代码来源:PlaceBookingScreenController.java

示例10: saveImage

@FXML
void saveImage() {
	if (image == null) {
		Alert a = new Alert(AlertType.ERROR);
		a.setContentText("No image to export!");
		a.show();
	}

	FileChooser fileChooser = new FileChooser();
	fileChooser.setInitialDirectory(Preferences.getPath("lastImageDir").toFile());
	fileChooser.setTitle("Save image");
	fileChooser.getExtensionFilters().addAll(
			new ExtensionFilter("PNG Images", "*.png"));
	File selected = fileChooser.showSaveDialog(getScene().getWindow());
	if (selected != null) {
		Preferences.setPath("lastImageDir", selected.toPath());

		try {
			ImageIO.write(image.toBufferedImage(), "png", selected);
		} catch (IOException e) {
			logger.error("Error while saving the image.", e);

			ExceptionDialog exceptionDialog = new ExceptionDialog(e);
			exceptionDialog.setTitle("Error");
			exceptionDialog.setHeaderText("Error while saving the image.");
			exceptionDialog.show();
		}
	}
}
 
开发者ID:Quantencomputer,项目名称:cyoastudio,代码行数:29,代码来源:ImageEditor.java

示例11: handleAddStudentAction

@FXML
private void handleAddStudentAction(ActionEvent event) {
    int studentId = 0;
    try {
        studentId = Integer.parseInt(studentIdField.getText());
    } catch (NumberFormatException nfe) {
        Alert alert = new Alert(AlertType.ERROR);
        alert.setTitle("Error Message");
        alert.setHeaderText("Incorrect student Id");
        alert.setContentText("Student Id has to be an integer in the range[1, 1000]");
        alert.showAndWait();
        return;
    }
    String studentName = studentNameField.getText();
    double cgpa = Double.parseDouble(cgpaField.getText());

    try {
        Connection connection = DriverManager
                .getConnection("jdbc:mysql://172.17.0.119/spring2017db",
                        "javauser",
                        "java");
        Statement statement = connection.createStatement();
        String query = "INSERT INTO student VALUES(" + studentId
                + ", '" + studentName + "', " + cgpa + ")";
        System.out.println(query);
        statement.executeUpdate(query);
        Student student = new Student(studentId, studentName, cgpa);
        studentsList.add(student);
        statusLabel.setText("Added a new entry for " + studentName);
        studentIdField.clear();
        studentNameField.clear();
        cgpaField.clear();
    } catch (SQLException sqle) {

    }

}
 
开发者ID:kmhasan-class,项目名称:spring2017java,代码行数:37,代码来源:FXMLDocumentController.java

示例12: showError

private void showError(String title, String message) {
	Alert alert = new Alert(AlertType.ERROR);
	alert.setTitle(title);
	alert.setHeaderText(null);
	alert.setContentText(message);
	alert.showAndWait();
}
 
开发者ID:jesuino,项目名称:java-ml-projects,代码行数:7,代码来源:App.java

示例13: displayErrorPopup

protected static void displayErrorPopup(Throwable errorToDisplay, String initialMessage) {
    Alert alert = new Alert(AlertType.ERROR, initialMessage + errorToDisplay.getMessage());

    GridPane expContent = createExceptionTextArea(errorToDisplay);

    alert.getDialogPane().setExpandableContent(expContent);
    alert.showAndWait();
}
 
开发者ID:ciphertechsolutions,项目名称:IO,代码行数:8,代码来源:BaseController.java

示例14: alertErrorMsg

public void alertErrorMsg(Stage stage) {

		Alert alert = new Alert(AlertType.ERROR);
		alert.initOwner(stage);
		alert.setTitle("Warning Dialog");
		alert.setHeaderText(null);
		alert.setContentText(this.msg);
		alert.showAndWait();

	}
 
开发者ID:kimyearho,项目名称:WebtoonDownloadManager,代码行数:10,代码来源:AlertSupport.java

示例15: errorPopUp

public Alert errorPopUp(String message){
	Alert errorAlert=new Alert(AlertType.ERROR);
	errorAlert.setHeaderText(message);
	return errorAlert;
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:5,代码来源:AlertHandler.java


注:本文中的javafx.scene.control.Alert.AlertType.ERROR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。