當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。