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


Java WindowEvent.consume方法代碼示例

本文整理匯總了Java中javafx.stage.WindowEvent.consume方法的典型用法代碼示例。如果您正苦於以下問題:Java WindowEvent.consume方法的具體用法?Java WindowEvent.consume怎麽用?Java WindowEvent.consume使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.stage.WindowEvent的用法示例。


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

示例1: handleCloseRequest

import javafx.stage.WindowEvent; //導入方法依賴的package包/類
@Override
protected void handleCloseRequest(WindowEvent event) {
	if(!gantt.isSaved()) { // TODO add cancel button
		ButtonType bt = FXDialog.binaryChoiceAlert("There are unsaved changes in this project. Save and close?").showAndWait().get();
		if(bt == ButtonType.YES) {
			saveGantt();
		} else {
			event.consume();
			return;
		}
	}	
	
	storageManager.rememberLastViewed(currentFile);
}
 
開發者ID:vibridi,項目名稱:qgu,代碼行數:15,代碼來源:QGUViewController.java

示例2: closeWarning

import javafx.stage.WindowEvent; //導入方法依賴的package包/類
private void closeWarning(WindowEvent windowEvent) {
  if (areAllPathsValid.get()) {
    return;
  }
  Alert alert = AlertFactory.createAlert(Alert.AlertType.CONFIRMATION, "Unset paths",
      "You are trying to close the wizard, but there are unset paths.",
      "This might leave the application in a state in which not all features are available. You can run the wizard again later by using the menu entry or specify the paths in the preferences. Are you sure to close the wizard now?");
  Optional<ButtonType> returnType = alert.showAndWait();
  if (!ButtonType.OK.equals(returnType.get())) {
    windowEvent.consume();
  }
}
 
開發者ID:VerifAPS,項目名稱:stvs,代碼行數:13,代碼來源:WelcomeWizard.java

示例3: preventCloseUntilServerShutdown

import javafx.stage.WindowEvent; //導入方法依賴的package包/類
private void preventCloseUntilServerShutdown(WindowEvent event) {
	if (serverService.getLocalServerStatus() != SyncingLocalServer.SyncingLocalServerStatus.OFFLINE) {
		event.consume();
		serverService.cancel();
		Alert alert = new Alert(Alert.AlertType.WARNING);
		alert.setHeaderText("Sync in progress");
		alert.setContentText("Please wait until the server has closed and synchronization is complete. If you ignore this warning, " +
				"your Minecraft world may be corrupted!");
		alert.show();
	}
}
 
開發者ID:Azzurite,項目名稱:MinecraftServerSync,代碼行數:12,代碼來源:MinecraftServerSync.java

示例4: handleClose

import javafx.stage.WindowEvent; //導入方法依賴的package包/類
protected void handleClose(FxWindow w, WindowEvent ev)
{
	OnWindowClosing ch = new OnWindowClosing(false);
	w.confirmClosing(ch);
	if(ch.isCancelled())
	{
		// don't close the window
		ev.consume();
	}
}
 
開發者ID:andy-goryachev,項目名稱:FxEditor,代碼行數:11,代碼來源:WindowsFx.java

示例5: handle

import javafx.stage.WindowEvent; //導入方法依賴的package包/類
@Override
public void handle(WindowEvent event) {
	/*we want to keep the Arma Dialog Creator window still open when asking to save progress before exiting.
	Consuming the event will keep window open and then we call closeApplication to execute the closing procedure and in turn, close the window*/
	event.consume();
	closeApplication(null);
}
 
開發者ID:kayler-renslow,項目名稱:arma-dialog-creator,代碼行數:8,代碼來源:ArmaDialogCreator.java

示例6: exit

import javafx.stage.WindowEvent; //導入方法依賴的package包/類
/**
 * Exits the program and consumes the event.
 *
 * @param event The event to consume
 */
protected void exit (final WindowEvent event)
{
    this.model.addLogMessage ("Window exit...");
    event.consume ();
    this.exit ();
}
 
開發者ID:git-moss,項目名稱:Push2Display,代碼行數:12,代碼來源:DisplayEmulator.java

示例7: handle

import javafx.stage.WindowEvent; //導入方法依賴的package包/類
@Override
public void handle(final WindowEvent event) {

    final Alert alert = new Alert(AlertType.CONFIRMATION);
    final ButtonType buttonTypeOne = new ButtonType("Yes", ButtonData.OK_DONE);
    final ButtonType buttonTypeTwo = new ButtonType("No", ButtonData.NO);
    final ButtonType buttonTypeCancel = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);
    alert.getButtonTypes().setAll(buttonTypeCancel, buttonTypeTwo, buttonTypeOne);
    alert.setTitle("Save changes?");
    alert.setHeaderText("Save changes?");

    final Optional<ButtonType> result = alert.showAndWait();

    if (result.get() == buttonTypeOne) {
        try {
            final FileChooser fileChooser = new FileChooser();
            final File file = SettingsManager.getInstance().getDataFile();
            fileChooser.setInitialDirectory(file.getParentFile());
            fileChooser.getExtensionFilters().addAll(
                    new FileChooser.ExtensionFilter("Dr.Booking Booking Data", Arrays.asList("*.xml")),
                    new FileChooser.ExtensionFilter("All Files", "*"));
            fileChooser.setTitle("Select File");
            fileChooser.setInitialFileName(file.getName());
            final File file2 = fileChooser.showSaveDialog(((Stage) event.getSource()));
            if (file2 != null) {
                SettingsManager.getInstance().setDataFile(file2);
                mainController.save(file);
            }
        } catch (final Exception e) {
            logger.error(e.getLocalizedMessage(), e);
        }
        exit();
    } else if (result.get() == buttonTypeTwo) {
        exit();
    } else {
        // cancel shutdown
        event.consume();
    }
}
 
開發者ID:DrBookings,項目名稱:drbookings,代碼行數:40,代碼來源:DrBookingsApplication.java

示例8: handleClose

import javafx.stage.WindowEvent; //導入方法依賴的package包/類
protected void handleClose(FxDockWindow w, WindowEvent ev)
{
	if(getWindowCount() == 1)
	{
		saveLayout();
	}
	
	OnWindowClosing ch = new OnWindowClosing(false);
	w.confirmClosing(ch);
	if(ch.isCancelled())
	{
		// don't close the window
		ev.consume();
	}
}
 
開發者ID:andy-goryachev,項目名稱:FxDock,代碼行數:16,代碼來源:FrameworkBase.java

示例9: onCloseRequest

import javafx.stage.WindowEvent; //導入方法依賴的package包/類
public void onCloseRequest(WindowEvent windowEvent) {
    if (!confirmExit()) {
        windowEvent.consume();
    }
}
 
開發者ID:aNNiMON,項目名稱:HotaruFX,代碼行數:6,代碼來源:EditorController.java


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