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


Java QuitHandler类代码示例

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


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

示例1: AppleSupportImpl

import com.apple.eawt.QuitHandler; //导入依赖的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

示例2: OSXSetup

import com.apple.eawt.QuitHandler; //导入依赖的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

示例3: main

import com.apple.eawt.QuitHandler; //导入依赖的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


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