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