Java Code Examples for javafx.stage.WindowEvent#consume()

The following examples show how to use javafx.stage.WindowEvent#consume() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExitRequestHandler.java    From VocabHunter with Apache License 2.0 6 votes vote down vote up
private boolean processCloseRequest(final WindowEvent e) {
    boolean isContinue = guiFileHandler.unsavedChangesCheck();

    if (isContinue) {
        WindowSettings windowSettings = new WindowSettings();

        windowSettings.setX(stage.getX());
        windowSettings.setY(stage.getY());
        windowSettings.setWidth(stage.getWidth());
        windowSettings.setHeight(stage.getHeight());
        model.getSessionModel().ifPresent(s -> saveSplitPositions(windowSettings, s));

        settingsManager.setWindowSettings(windowSettings);
    } else {
        e.consume();
    }

    return isContinue;
}
 
Example 2
Source File: ArmaDialogCreator.java    From arma-dialog-creator with MIT License 5 votes vote down vote up
@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();
	AskSaveProjectDialog dialog = new AskSaveProjectDialog();
	dialog.show();
	if (dialog.saveProgress()) {
		ApplicationManager.instance.saveProject();
	}
	ApplicationManager.instance.closeApplication();
}
 
Example 3
Source File: WindowsFx.java    From FxDock with Apache License 2.0 5 votes vote down vote up
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();
	}
}
 
Example 4
Source File: FrameworkBase.java    From FxDock with Apache License 2.0 5 votes vote down vote up
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();
	}
}
 
Example 5
Source File: JFXMenuShowListenerManager.java    From tuxguitar with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void handle(WindowEvent event) {
	if(!this.control.isIgnoreEvents()) {
		this.onMenuShow(new UIMenuEvent(this.control));
		
		event.consume();
	}
}
 
Example 6
Source File: JFXMenuHideListenerManager.java    From tuxguitar with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void handle(WindowEvent event) {
	if(!this.control.isIgnoreEvents()) {
		this.onMenuHide(new UIMenuEvent(this.control));
		
		event.consume();
	}
}
 
Example 7
Source File: JFXWindow.java    From tuxguitar with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void handle(WindowEvent event) {
	event.consume();
	
	this.window.close();
}