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


Java OSXAdapter类代码示例

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


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

示例1: IGVMenuBar

import apple.dts.samplecode.osxadapter.OSXAdapter; //导入依赖的package包/类
private IGVMenuBar(IGV igv) {
    this.igv = igv;
    setBorder(new BasicBorders.MenuBarBorder(Color.GRAY, Color.GRAY));
    setBorderPainted(true);

    for (AbstractButton menu : createMenus()) {
        add(menu);
    }

    //This is for Macs, so showing the about dialog
    //from the command bar does what we want.
    if (Globals.IS_MAC) {
        try {
            OSXAdapter.setAboutHandler(this, getClass().getDeclaredMethod("showAboutDialog", (Class[]) null));
            OSXAdapter.setQuitHandler(ShutdownThread.class, ShutdownThread.class.getDeclaredMethod("runS", (Class[]) null));
        } catch (Exception e) {
            log.error("Error setting apple-specific about and quit handlers", e);
        }

    }
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:22,代码来源:IGVMenuBar.java

示例2: registerForMacOSXEvents

import apple.dts.samplecode.osxadapter.OSXAdapter; //导入依赖的package包/类
private void registerForMacOSXEvents() {
	if (MAC_OS_X) {
		try {
			// Generate and register the OSXAdapter, passing it a hash of
			// all the methods we wish to
			// use as delegates for various
			// com.apple.eawt.ApplicationListener methods
			OSXAdapter.setQuitHandler(this, getClass().getDeclaredMethod("quit", (Class[]) null));
			OSXAdapter.setAboutHandler(this, getClass().getDeclaredMethod("about", (Class[]) null));
			OSXAdapter.setPreferencesHandler(this, getClass().getDeclaredMethod("preferences", (Class[]) null));
			OSXAdapter.setFileHandler(this, getClass().getDeclaredMethod("loadFile", new Class[] { String.class }));
		} catch (Exception e) {
			System.err.println("Error while loading the OSXAdapter:");
			e.printStackTrace();
		}
	}
}
 
开发者ID:cyriux,项目名称:mpcmaid,代码行数:18,代码来源:BaseFrame.java

示例3: registerForMacOSXEvents

import apple.dts.samplecode.osxadapter.OSXAdapter; //导入依赖的package包/类
public void registerForMacOSXEvents() {
	if (MAC_OS_X) {
		try {
			// Generate and register the OSXAdapter, passing it a hash of
			// all the methods we wish to
			// use as delegates for various
			// com.apple.eawt.ApplicationListener methods
			OSXAdapter.setQuitHandler(this, getClass().getDeclaredMethod("onQuit", (Class[]) null));
			// OSXAdapter.setAboutHandler(this,
			// getClass().getDeclaredMethod("about", (Class[])null));
			// OSXAdapter.setPreferencesHandler(this,
			// getClass().getDeclaredMethod("preferences", (Class[])null));
			System.setProperty("apple.laf.useScreenMenuBar", "true");
		} catch (Exception e) {
			System.err.println("Error while loading the OSXAdapter:");
			e.printStackTrace();
		}
	}
}
 
开发者ID:Erkaman,项目名称:NeoTextureEdit2,代码行数:20,代码来源:TextureEditor.java

示例4: buildCompleteMenuBar

import apple.dts.samplecode.osxadapter.OSXAdapter; //导入依赖的package包/类
public JMenuBar buildCompleteMenuBar() {

        JMenuBar menuBar = new JMenuBar();
        addToMenuBar(menuBar, buildFileMenu());
        addToMenuBar(menuBar, buildEditMenu());
        addToMenuBar(menuBar, buildViewMenu());
        addToMenuBar(menuBar, buildDocumentMenu());
        addToMenuBar(menuBar, buildWindowMenu());
        addToMenuBar(menuBar, buildHelpMenu());

        // If running on MacOS, setup the native app. menu item handlers
        if (isMacOs) {
            try {
                // Generate and register the OSXAdapter, passing it a hash of all the methods we wish to
                // use as delegates for various com.apple.eawt.ApplicationListener methods
                OSXAdapter.setQuitHandler(viewerController, viewerController.getClass().getDeclaredMethod("exit", (Class[]) null));
                OSXAdapter.setAboutHandler(viewerController, viewerController.getClass().getDeclaredMethod("showAboutDialog", (Class[]) null));
            } catch (Exception e) {
                logger.log(Level.FINE, "Error occurred while loading the OSXAdapter:", e);
            }
        }

        return menuBar;
    }
 
开发者ID:pdf4j,项目名称:icepdf,代码行数:25,代码来源:SwingViewBuilder.java

示例5: getFrame

import apple.dts.samplecode.osxadapter.OSXAdapter; //导入依赖的package包/类
/**
 * Lazily creates and returns the frame of this simulator.
 */
public JFrame getFrame() {
    if (this.frame == null) {
        // force the LAF to be set
        groove.gui.Options.initLookAndFeel();

        // set up the frame
        this.frame = new JFrame(APPLICATION_NAME);
        // small icon doesn't look nice due to shadow
        this.frame.setIconImage(Icons.GROOVE_ICON_16x16.getImage());
        this.frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

        // register doQuit() for the Command-Q shortcut on MacOS
        if (Groove.IS_PLATFORM_MAC) {
            try {
                OSXAdapter.setQuitHandler(this, this.getClass()
                    .getDeclaredMethod("tryQuit"));
            } catch (NoSuchMethodException e1) {
                // should not happen (thrown when 'tryQuit' does not exist)
                // ignore
            }
        }
        // register doQuit() as the closing method of the window
        this.frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                Simulator.this.actions.getQuitAction()
                    .execute();
            }
        });
        this.frame.setJMenuBar(createMenuBar());
        this.frame.setContentPane(getContentPanel());
        // make sure tool tips get displayed
        ToolTipManager.sharedInstance()
            .registerComponent(getContentPanel());
    }
    return this.frame;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:41,代码来源:Simulator.java

示例6: registerForMacOSXEvents

import apple.dts.samplecode.osxadapter.OSXAdapter; //导入依赖的package包/类
private void registerForMacOSXEvents(PreferencesWindow pf, AboutWindow af) {
	if (Util.MAC_OS_X) {
        try {
			OSXAdapter.setQuitHandler(this, WiimoteWhiteboard.class.getDeclaredMethod("quitApp", (Class[])null));				
			if (!Util.INSIDE_APP_BUNDLE) {
				OSXAdapter.setAboutHandler(af, AboutWindow.class.getDeclaredMethod("about", (Class[])null));
			}
			OSXAdapter.setPreferencesHandler(pf, PreferencesWindow.class.getDeclaredMethod("preferences", (Class[])null));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:operadordecamara,项目名称:wiimote-paintboard,代码行数:14,代码来源:WiimoteWhiteboard.java

示例7: registerForMacOSXEvents

import apple.dts.samplecode.osxadapter.OSXAdapter; //导入依赖的package包/类
public void registerForMacOSXEvents() {
    if ( PhetUtilities.isMacintosh() ) {
        try {
            // Generate and register the OSXAdapter, passing it a hash of all the methods we wish to
            // use as delegates for various com.apple.eawt.ApplicationListener methods.
            // NOTE: This uses reflection and requires security privileges, so use only in signed applications.
            OSXAdapter.setQuitHandler( this, LWJGLPhetApplication.class.getDeclaredMethod( "macQuit", (Class[]) null ) );
        }
        catch( Exception e ) {
            System.err.println( "Error while loading the OSXAdapter:" );
            e.printStackTrace();
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:15,代码来源:LWJGLPhetApplication.java

示例8: registerForMacOSXEvents

import apple.dts.samplecode.osxadapter.OSXAdapter; //导入依赖的package包/类
public void registerForMacOSXEvents() {
    if ( PhetUtilities.isMacintosh() ) {
        try {
            // Generate and register the OSXAdapter, passing it a hash of all the methods we wish to
            // use as delegates for various com.apple.eawt.ApplicationListener methods.
            // NOTE: This uses reflection and requires security privileges, so use only in signed applications.
            OSXAdapter.setQuitHandler( this, JMEPhetApplication.class.getDeclaredMethod( "macQuit", (Class[]) null ) );
        }
        catch ( Exception e ) {
            System.err.println( "Error while loading the OSXAdapter:" );
            e.printStackTrace();
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:15,代码来源:JMEPhetApplication.java

示例9: setAppleDockIcon

import apple.dts.samplecode.osxadapter.OSXAdapter; //导入依赖的package包/类
private void setAppleDockIcon() {
    try {
        Image image = getIconImage();
        OSXAdapter.setDockIconImage(image);
    } catch (Exception e) {
        log.error("Error setting apple dock icon", e);
    }
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:9,代码来源:IGV.java


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