当前位置: 首页>>代码示例>>Java>>正文


Java QuitEvent类代码示例

本文整理汇总了Java中com.apple.eawt.AppEvent.QuitEvent的典型用法代码示例。如果您正苦于以下问题:Java QuitEvent类的具体用法?Java QuitEvent怎么用?Java QuitEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


QuitEvent类属于com.apple.eawt.AppEvent包,在下文中一共展示了QuitEvent类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleQuitRequestWith

import com.apple.eawt.AppEvent.QuitEvent; //导入依赖的package包/类
/** 
 * Handle quit action 
 * @param qe quit event
 * @param response quit response
 */
@Override
public void handleQuitRequestWith(final QuitEvent qe, final QuitResponse response) {
    logEDT("handleQuitRequestWith");

    /* This is important for cross-platform development -- have a universal quit
     * routine that chooses whether or not to quit, so the functionality is identical
     * on all platforms.  This example simply cancels the AppleEvent-based quit and
     * defers to that universal method. */

    invokeLaterUsingApplicationEDT(new Runnable() {
        @Override
        public void run() {
            logEDT("handleQuitRequestWith");

            /*
             * the Quit action must call response.cancelQuit() or response.performQuit()
             * Note: QuitResponse is thread safe and methods can be called after handleQuitRequestWith() returns.
             */
            _registrar.getQuitAction().actionPerformed(new ActionEvent(response, 0, null));
        }
    });
}
 
开发者ID:JMMC-OpenDev,项目名称:jMCS,代码行数:28,代码来源:MacOSXAdapter.java

示例2: AppleSupportImpl

import com.apple.eawt.AppEvent.QuitEvent; //导入依赖的package包/类
public AppleSupportImpl() {
    application = Application.getApplication();
    application.setAboutHandler(new AboutHandler() {
        @Override
        public void handleAbout(AboutEvent aboutEvent) {
            JOptionPane.showMessageDialog(null, "LedMatrix control\n(c) The Cave, 2017\nhttps://www.thecave.cz", "About", JOptionPane.INFORMATION_MESSAGE);
        }
    });

    application.setQuitHandler(new QuitHandler() {
        @Override
        public void handleQuitRequestWith(QuitEvent quitEvent, final QuitResponse quitResponse) {
            if (quitResponder == null) {
                quitResponse.performQuit();
                return;
            }

            quitResponder.canQuit(new QuitResponderDecision() {
                @Override
                public void canQuit() {
                    quitResponse.performQuit();
                }

                @Override
                public void dontQuit() {
                    quitResponse.cancelQuit();
                }
            });
        }
    });

    try {
        Image img = IconHelper.readIcon();
        if (img != null)
            application.setDockIconImage(img);
    } catch (Exception ignored) {
    }
}
 
开发者ID:TheCaveCz,项目名称:letsmake-ledmatrix,代码行数:39,代码来源:AppleSupportImpl.java

示例3: OSXSetup

import com.apple.eawt.AppEvent.QuitEvent; //导入依赖的package包/类
public void OSXSetup() {
	Application app = Application.getApplication();

	app.setAboutHandler(new AboutHandler() {
		public void handleAbout(AboutEvent ae) {
			about();
		}
	});

	app.setPreferencesHandler(new PreferencesHandler() {
		public void handlePreferences(PreferencesEvent pe) {
			PreferencesDialog.showPreferences(frame);
			//EditPreferences editPreferences = new EditPreferences(frame, async);
			//editPreferences.preferences();
			tree.setExpandibleIcons(!IBioSimPreferences.INSTANCE.isPlusMinusIconsEnabled());
			if (sbolDocument != null) {
				sbolDocument.setDefaultURIprefix(SBOLEditorPreferences.INSTANCE.getUserInfo().getURI().toString());
			}
		}
	});

	app.setQuitHandler(new QuitHandler() {
		public void handleQuitRequestWith(QuitEvent event, QuitResponse response) {
			exit();
		}
	});
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:28,代码来源:Gui.java

示例4: handleQuitRequestWith

import com.apple.eawt.AppEvent.QuitEvent; //导入依赖的package包/类
@Override
public void handleQuitRequestWith(final QuitEvent arg0, final QuitResponse arg1) {
  if (shutdownFrame != null) {
    shutdownFrame.shutdown();
  } else {
    System.exit(0);
  }
}
 
开发者ID:triplea-game,项目名称:triplea,代码行数:9,代码来源:MacQuitMenuWrapper.java

示例5: handleQuitRequestWith

import com.apple.eawt.AppEvent.QuitEvent; //导入依赖的package包/类
@Override
public void handleQuitRequestWith(final QuitEvent qe, final QuitResponse qr) {
    new Thread(new Runnable() {

        @Override
        public void run() {
            exit();
            qr.cancelQuit();
        }
    }).start();
}
 
开发者ID:AnyObject,项目名称:OAT,代码行数:12,代码来源:Main.java

示例6: handleQuitRequestWith

import com.apple.eawt.AppEvent.QuitEvent; //导入依赖的package包/类
@Override
public void handleQuitRequestWith(QuitEvent evt, QuitResponse resp) {
    if (parentFrame == null) {
        return;
    }

    if (parentFrame.quit()) {
        resp.performQuit();
    } else {
        resp.cancelQuit();
    }
}
 
开发者ID:JabRef,项目名称:jabref,代码行数:13,代码来源:MacAdapter.java

示例7: handleQuitRequestWith

import com.apple.eawt.AppEvent.QuitEvent; //导入依赖的package包/类
@Override
public void handleQuitRequestWith(QuitEvent event, QuitResponse response) {
	if (!UIUtilities.inModalState()) {
		mAllowQuitIfNoSignificantWindowsOpen = false;
		if (closeFrames(true)) {
			if (closeFrames(false)) {
				saveState();
				response.performQuit();
				return;
			}
		}
		mAllowQuitIfNoSignificantWindowsOpen = true;
	}
	response.cancelQuit();
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:16,代码来源:QuitCommand.java

示例8: handleQuitRequestWith

import com.apple.eawt.AppEvent.QuitEvent; //导入依赖的package包/类
@Override
public void handleQuitRequestWith(QuitEvent e, QuitResponse response) {
	mainWindow.shutdownWindow();
}
 
开发者ID:ac2cz,项目名称:FoxTelem,代码行数:5,代码来源:MacQuitHandler.java

示例9: main

import com.apple.eawt.AppEvent.QuitEvent; //导入依赖的package包/类
public static void main( String[] args )
{
    try {
        // These four lines duplicate ApplicationUI.main()
        String prop = System .getProperty( "user.dir" );
        File workingDir = new File( prop );
        URL codebase = workingDir .toURI() .toURL();
        final ApplicationUI ui = ApplicationUI .initialize( args, codebase );
        
        // Now hook it up to the Finder events
        Application appl = Application .getApplication();
        
        appl .setOpenFileHandler( new OpenFilesHandler()
        {
            public void openFiles( OpenFilesEvent ofe )
            {
                for (Iterator iterator = ofe .getFiles() .iterator(); iterator.hasNext(); ) {
                    File file = (File) iterator.next();
                    ui .openFile( file );
                }
            }
        } );
        
        appl .setAboutHandler( new AboutHandler()
        {
            public void handleAbout( AboutEvent about )
            {
                ui .about();
            }
        } );
        
        appl .setQuitHandler( new QuitHandler()
        {
            public void handleQuitRequestWith( QuitEvent qe, QuitResponse qr )
            {
                if ( ui .quit() )
                    qr .performQuit();
                else
                    qr .cancelQuit();
                    
            }
        } );    

    } catch ( Throwable e ) {
        Logger .getLogger( "com.vzome.platform.mac.Adapter" )
            .log( Level.SEVERE, "problem in main()", e );
    }
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:49,代码来源:Adapter.java

示例10: handleQuitRequestWith

import com.apple.eawt.AppEvent.QuitEvent; //导入依赖的package包/类
@Override
public void handleQuitRequestWith(final QuitEvent e, final QuitResponse r) {
	eventService.publish(new AppQuitEvent());
	r.cancelQuit();
}
 
开发者ID:scijava,项目名称:scijava-plugins-platforms,代码行数:6,代码来源:MacOSAppEventDispatcher.java

示例11: handleQuitRequestWith

import com.apple.eawt.AppEvent.QuitEvent; //导入依赖的package包/类
/**
 * Invoked when the application is asked to quit.
 *
 * Implementors must call either {@link QuitResponse#cancelQuit()}, {@link QuitResponse#performQuit()}, or ensure the application terminates.
 * The process (or log-out) requesting this app to quit will be blocked until the {@link QuitResponse} is handled.
 * Apps that require complex UI to shutdown may call the {@link QuitResponse} from any thread.
 * Your app may be asked to quit multiple times before you have responded to the initial request.
 * This handler is called each time a quit is requested, and the same {@link QuitResponse} object is passed until it is handled.
 * Once used, the {@link QuitResponse} cannot be used again to change the decision.
 *
 * @param e the request to quit this application.
 * @param response the one-shot response object used to cancel or proceed with the quit action.
 */
public void handleQuitRequestWith(final QuitEvent e, final QuitResponse response);
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:QuitHandler.java


注:本文中的com.apple.eawt.AppEvent.QuitEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。