当前位置: 首页>>代码示例>>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;未经允许,请勿转载。