當前位置: 首頁>>代碼示例>>Java>>正文


Java AlertType類代碼示例

本文整理匯總了Java中javafx.scene.control.Alert.AlertType的典型用法代碼示例。如果您正苦於以下問題:Java AlertType類的具體用法?Java AlertType怎麽用?Java AlertType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AlertType類屬於javafx.scene.control.Alert包,在下文中一共展示了AlertType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: save

import javafx.scene.control.Alert.AlertType; //導入依賴的package包/類
private void save(DSSDocument signedDocument) {
	FileChooser fileChooser = new FileChooser();
	fileChooser.setInitialFileName(signedDocument.getName());
	MimeType mimeType = signedDocument.getMimeType();
	ExtensionFilter extFilter = new ExtensionFilter(mimeType.getMimeTypeString(), "*." + MimeType.getExtension(mimeType));
	fileChooser.getExtensionFilters().add(extFilter);
	File fileToSave = fileChooser.showSaveDialog(stage);

	if (fileToSave != null) {
		try {
			FileOutputStream fos = new FileOutputStream(fileToSave);
			Utils.copy(signedDocument.openStream(), fos);
			Utils.closeQuietly(fos);
		} catch (Exception e) {
			Alert alert = new Alert(AlertType.ERROR, "Unable to save file : " + e.getMessage(), ButtonType.CLOSE);
			alert.showAndWait();
			return;
		}
	}
}
 
開發者ID:esig,項目名稱:dss-demonstrations,代碼行數:21,代碼來源:SignatureController.java

示例2: displayDeleteGameAlert

import javafx.scene.control.Alert.AlertType; //導入依賴的package包/類
public static void displayDeleteGameAlert() {
    int index = -1;

    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setHeaderText(null);
    alert.setContentText("Are you sure you want to delete the selected games?");

    ButtonType deleteGame = new ButtonType("Delete Game(s)");
    ButtonType buttonTypeCancel = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);

    alert.getButtonTypes().setAll(deleteGame, buttonTypeCancel);

    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == deleteGame){
        for (String g : selectedGamesString) {
            index = getGameIndex(g);
            gameList.getGameList().remove(index);
        }

        refreshGameList();
        deleteButton.setDisable(true);
    }
    else {
        // ... user chose CANCEL or closed the dialog
    }
}
 
開發者ID:Stevoisiak,項目名稱:Virtual-Game-Shelf,代碼行數:27,代碼來源:GameShelf.java

示例3: processCheckOutButtonPressed

import javafx.scene.control.Alert.AlertType; //導入依賴的package包/類
/**
 * Process the transaction when a student check-out a book.
 * @param event The even that triggered this function.
 * @throws IOException IOException In case a file cannot be loaded.
 * @throws SQLException The even that triggered this function
 */
@FXML public void processCheckOutButtonPressed(ActionEvent event) 
        throws IOException, SQLException
{
    BooksIssued transaction = new BooksIssued(Long.valueOf(isbnCheckOutTF.getText()),
            Integer.valueOf(iDCheckOutTF.getText()));
    int success = transaction.processCheckOutTransaction();
    
    if(success == 1){
        displayAlert(Alert.AlertType.INFORMATION,"Receipt" , 
            ("Transaction ID: " + transaction.getTransID() + "\n\nStudent ID: " + 
            transaction.getCardID() + "\nIssue Date: " + transaction.getIssueDate() +
            "\nDue Date: " + transaction.getDueDate()), "1");
        
        Books book = new Books(Long.valueOf(isbnCheckOutTF.getText()),
            Integer.valueOf(copiesCheckOutTF.getText()));
        book.decreasedCopies();
        clearCheckOutForm();
        resultsTableView.getItems().clear(); //clear table data to show new one.
    }
    else{
        displayAlert(Alert.AlertType.WARNING,"Error" , 
            ("Error adding student"), "6");
    }
}
 
開發者ID:pxndroid,項目名稱:mountieLibrary,代碼行數:31,代碼來源:MainWindowController.java

示例4: removeMemberAction

import javafx.scene.control.Alert.AlertType; //導入依賴的package包/類
private void removeMemberAction(Event e) {
	MemberView selected = memberTable.selectionModelProperty().get().getSelectedItem();

	if (selected != null) { 
		Alert conf = new Alert(AlertType.CONFIRMATION, "Do you really want to transfert " + organization.getName() + "'s ownership to "+ selected.getUsername() + " ?\n");
		Optional<ButtonType> result = conf.showAndWait();

		if (result.isPresent() && result.get().equals(ButtonType.OK))  {
			try {
				organization.removeMember(selected.getId());
			} catch (JSONException | WebApiException | IOException | HttpException e1) {
				ErrorUtils.getAlertFromException(e1).show();
				forceUpdateMemberList();
				e1.printStackTrace();
			}
		}
	}
}
 
開發者ID:ScreachFr,項目名稱:titanium,代碼行數:19,代碼來源:MemberPane.java

示例5: transferOwnershipAction

import javafx.scene.control.Alert.AlertType; //導入依賴的package包/類
private void transferOwnershipAction(Event e) {
	MemberView selected = memberTable.selectionModelProperty().get().getSelectedItem();

	if (selected != null) {  
		Alert conf = ErrorUtils.newAlert(AlertType.CONFIRMATION, "Transfer ownership confirmation",
				"Do you really want to transfer " + organization.getName() + "'s ownership to "+ selected.getUsername() + " ?",
				"This action is definitive, be careful.");
		Optional<ButtonType> result = conf.showAndWait();

		if (result.isPresent() && result.get().equals(ButtonType.OK))  {
			try {
				organization.transfertOwnership(selected.getId());
				eos.close();
			} catch (JSONException | WebApiException | IOException | HttpException e1) {
				ErrorUtils.getAlertFromException(e1).show();
				e1.printStackTrace();
			}
		}
	}



}
 
開發者ID:ScreachFr,項目名稱:titanium,代碼行數:24,代碼來源:MemberPane.java

示例6: removeAction

import javafx.scene.control.Alert.AlertType; //導入依賴的package包/類
private void removeAction(Event e) {
	Alert conf = new Alert(AlertType.CONFIRMATION, "Do you really want to delete this organization ?\n"
			+ "Every server and member association will be lost.");

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

	if (result.isPresent() && result.get().equals(ButtonType.OK)) {
		try {
			wsp.removeOrganization(orgas.selectionModelProperty().get().getSelectedItem().getOrganization());
			forceOrganizationListRefresh();
			App.getCurrentInstance().refreshWSPTabs();
		} catch(Exception e1) {
			ErrorUtils.getAlertFromException(e1).show();
		}
	}
}
 
開發者ID:ScreachFr,項目名稱:titanium,代碼行數:17,代碼來源:OrganizationManagerStage.java

示例7: editWSPAction

import javafx.scene.control.Alert.AlertType; //導入依賴的package包/類
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,代碼行數:20,代碼來源:MainPane.java

示例8: mnuUndo

import javafx.scene.control.Alert.AlertType; //導入依賴的package包/類
@FXML
private void mnuUndo(ActionEvent event) {
	Stage SettingsStage = (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(SettingsStage.getX() + 60);
	alert.setY(SettingsStage.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(SettingsStage.getX(), SettingsStage.getY());
		SettingsStage.close();
	}
}
 
開發者ID:krHasan,項目名稱:Money-Manager,代碼行數:17,代碼來源:SettingsController.java

示例9: changeLocaleAndReload

import javafx.scene.control.Alert.AlertType; //導入依賴的package包/類
public void changeLocaleAndReload(String locale){
	saveCurrentProject();
       Alert alert = new Alert(AlertType.CONFIRMATION);
       alert.setTitle("Confirmation Dialog");
       alert.setHeaderText("This will take effect after reboot");
       alert.setContentText("Are you ok with this?");

       Optional<ButtonType> result = alert.showAndWait();
       if (result.get() == ButtonType.OK){
           // ... user chose OK
       	try {
   	        Properties props = new Properties();
   	        props.setProperty("locale", locale);
   	        File f = new File(getClass().getResource("../bundles/Current.properties").getFile());
   	        OutputStream out = new FileOutputStream( f );
   	        props.store(out, "This is an optional header comment string");
   	        
   	        start(primaryStage);
   	    }
   	    catch (Exception e ) {
   	        e.printStackTrace();
   	    }
       } else {
           // ... user chose CANCEL or closed the dialog
       }
}
 
開發者ID:coco35700,項目名稱:uPMT,代碼行數:27,代碼來源:Main.java

示例10: unarchiveSector

import javafx.scene.control.Alert.AlertType; //導入依賴的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) {}
}
 
開發者ID:krHasan,項目名稱:Money-Manager,代碼行數:18,代碼來源:SettingsController.java

示例11: mnuUndo

import javafx.scene.control.Alert.AlertType; //導入依賴的package包/類
@FXML
private void mnuUndo(ActionEvent event) {
	Stage DashboardStage = (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(DashboardStage.getX() + 60);
	alert.setY(DashboardStage.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(DashboardStage.getX(), DashboardStage.getY());
		DashboardStage.close();
	}
}
 
開發者ID:krHasan,項目名稱:Money-Manager,代碼行數:17,代碼來源:DashboardController.java

示例12: alertErrorConfirm

import javafx.scene.control.Alert.AlertType; //導入依賴的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;

	}
 
開發者ID:kimyearho,項目名稱:WebtoonDownloadManager,代碼行數:19,代碼來源:AlertSupport.java

示例13: handleDeleteEntry

import javafx.scene.control.Alert.AlertType; //導入依賴的package包/類
@FXML
private void handleDeleteEntry() {
	int selectedIndex = entryTable.getSelectionModel().getSelectedIndex();

	if (selectedIndex >= 0) {
		entryTable.getItems().remove(selectedIndex);
	}
	else {
		Alert alert = new Alert(AlertType.WARNING);
		alert.initOwner(mainApp.getPrimaryStage());
		alert.setTitle("No Selection");
		alert.setHeaderText("No Entry Selected");
		alert.setContentText("Please select an entry in the table");
		alert.showAndWait();
	}
}
 
開發者ID:yc45,項目名稱:kanphnia2,代碼行數:17,代碼來源:ToDoOverviewController.java

示例14: saveMatches

import javafx.scene.control.Alert.AlertType; //導入依賴的package包/類
private void saveMatches() {
	Path path = Gui.requestFile("Save matches file", gui.getScene().getWindow(), Arrays.asList(new FileChooser.ExtensionFilter("Matches", "*.match")), false);
	if (path == null) return;

	if (!path.getFileName().toString().toLowerCase(Locale.ENGLISH).endsWith(".match")) {
		path = path.resolveSibling(path.getFileName().toString()+".match");
	}

	try {
		if (Files.isDirectory(path)) {
			gui.showAlert(AlertType.ERROR, "Save error", "Invalid file selection", "The selected file is a directory.");
		} else if (Files.exists(path)) {
			Files.deleteIfExists(path);
		}

		if (!gui.getMatcher().saveMatches(path)) {
			gui.showAlert(AlertType.WARNING, "Matches save warning", "No matches to save", "There are currently no matched classes, so saving was aborted.");
		}
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		return;
	}
}
 
開發者ID:sfPlayer1,項目名稱:Matcher,代碼行數:25,代碼來源:FileMenu.java

示例15: presentNewGameProposalWindow

import javafx.scene.control.Alert.AlertType; //導入依賴的package包/類
@FXML
public void presentNewGameProposalWindow(Event e) {
	TextInputDialog dialog = new TextInputDialog();
	dialog.setHeaderText("Neuer Spielvorschalg");
	dialog.setContentText("Wie soll das Spiel heissen?");
	
	Optional<String> gameNameResult = dialog.showAndWait();
	gameNameResult.ifPresent(result -> {
		if (!gameNameResult.get().isEmpty()) {
			this.client.enqueueTask(new CommunicationTask(new ClientMessage("server", "newgame", gameNameResult.get()), (success, response) -> {
				Platform.runLater(() -> {
					if (success && response.getDomain().equals("success") && response.getCommand().equals("created")) {
						refreshGameList(e);
						System.out.println("Game erstellt");
					} else {
						Alert alert = new Alert(AlertType.ERROR);
						alert.setHeaderText("Das Spiel konnte nicht erstellt werden");
						alert.setContentText(response.toString());
						alert.show();
					}
				});
			}));
		}
	});
}
 
開發者ID:lukasbischof,項目名稱:Orsum-occulendi,代碼行數:26,代碼來源:Controller.java


注:本文中的javafx.scene.control.Alert.AlertType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。