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


Java ApplicationEvent类代码示例

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


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

示例1: initializeMacOS

import com.apple.eawt.ApplicationEvent; //导入依赖的package包/类
private void initializeMacOS() {
    if (SystemUtils.isMacOS()) {
        final Application application = Application.getApplication();
        if(application == null) {
            // e.g. running OpenJDK port via X11 on Mac OS X
            return;
        }
        application.removeAboutMenuItem();
        application.removePreferencesMenuItem();
        application.addApplicationListener(new ApplicationAdapter() {

            @Override
            public void handleQuit(ApplicationEvent event) {
                cancelContainer();
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:SwingFrameContainer.java

示例2: handlePreferences

import com.apple.eawt.ApplicationEvent; //导入依赖的package包/类
@Override
public void handlePreferences(ApplicationEvent event) {
    PreferencesEditorDialog myPrefs =
            new PreferencesEditorDialog(
            parent,
            true,
            ((ETReduxFrame)parent).getMyState().getReduxPreferences());
    myPrefs.setSize(375, 540);
    myPrefs.setVisible(true);
    
    ((ETReduxFrame)parent)
    .getTheSample()
    .setFractionDataOverriddenOnImport(
            myPrefs.getReduxPreferences().isFractionDataOverriddenOnImport());
    
    event.setHandled(true);
}
 
开发者ID:CIRDLES,项目名称:ET_Redux,代码行数:18,代码来源:MacOSAboutHandler.java

示例3: handleQuit

import com.apple.eawt.ApplicationEvent; //导入依赖的package包/类
/** This is called when the user does Application->Quit */
@Override
public void handleQuit(ApplicationEvent event) {
    // TODO this should not be hardcoded --> look up by menuitem name
    
    Component[] sampleFile = parent.getJMenuBar().getMenu(0).getMenuComponents();
    for (Component sampleFile1 : sampleFile) {
        if (sampleFile1.getClass().getName().equalsIgnoreCase("javax.swing.JMenuItem")) {
            if (((AbstractButton) sampleFile1).getText().equalsIgnoreCase("Exit")) {
                ((AbstractButton) sampleFile1).doClick();
                event.setHandled(true);
            }
        }
    }
    
}
 
开发者ID:CIRDLES,项目名称:ET_Redux,代码行数:17,代码来源:MacOSAboutHandler.java

示例4: handleAbout

import com.apple.eawt.ApplicationEvent; //导入依赖的package包/类
@Override
public void handleAbout(ApplicationEvent ae) {
    if (mainApp != null) {
        ae.setHandled(true);
                    // We need to invoke modal About Dialog asynchronously
                    // otherwise the Application queue is locked for the duration
                    // of the about Dialog, which results in a deadlock if a URL is
                    // selected, and we get a ReOpenApplication event when user
                    // switches back to Findbugs.
                    javax.swing.SwingUtilities.invokeLater(new Runnable() {
                            public void run() {
                                mainApp.about();
                            }
                        });
    } else {
        throw new IllegalStateException("handleAbout: " +
                                                    "MyApp instance detached from listener");
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:20,代码来源:OSXAdapter.java

示例5: handleQuit

import com.apple.eawt.ApplicationEvent; //导入依赖的package包/类
@Override
public void handleQuit(ApplicationEvent ae) {
    if (mainApp != null) {

        /*
                     * You MUST setHandled(false) if you want to
         * delay or cancel the quit. 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.
        */

        ae.setHandled(false);
        mainApp.exitFindBugs();
    } else {
        throw new IllegalStateException("handleQuit: MyApp instance detached " +
                                                    "from listener");
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:23,代码来源:OSXAdapter.java

示例6: handleAbout

import com.apple.eawt.ApplicationEvent; //导入依赖的package包/类
@Override
public void handleAbout(ApplicationEvent ae) {
    if (mainApp != null) {
        ae.setHandled(true);
        // We need to invoke modal About Dialog asynchronously
        // otherwise the Application queue is locked for the duration
        // of the about Dialog, which results in a deadlock if a URL is
        // selected, and we get a ReOpenApplication event when user
        // switches back to Findbugs.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                mainApp.about();
            }
        });
    } else {
        throw new IllegalStateException("handleAbout: " + "MyApp instance detached from listener");
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:19,代码来源:OSXAdapter.java

示例7: handleQuit

import com.apple.eawt.ApplicationEvent; //导入依赖的package包/类
@Override
public void handleQuit(ApplicationEvent ae) {
    if (mainApp != null) {

        /*
         * You MUST setHandled(false) if you want to delay or cancel the
         * quit. 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.
         */

        ae.setHandled(false);
        mainApp.callOnClose();
    } else {
        throw new IllegalStateException("handleQuit: MyApp instance detached " + "from listener");
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:20,代码来源:OSXAdapter.java

示例8: handleOpenFile

import com.apple.eawt.ApplicationEvent; //导入依赖的package包/类
public void handleOpenFile(final ApplicationEvent event) {
    File f = new File(event.getFilename());
    try {
        IdeaDocument document = ReaderFactory.getInstance().read(f);
        Main.getMainframe().setDocument(document);
    } catch (ReaderException re) {
        re.printStackTrace();
    }
    event.setHandled(true);
}
 
开发者ID:dogriffiths,项目名称:hipster,代码行数:11,代码来源:MacAppListener.java

示例9: handleAbout

import com.apple.eawt.ApplicationEvent; //导入依赖的package包/类
public void handleAbout(ApplicationEvent ae) {
    if (aboutAction != null) {
        ae.setHandled(true);
        aboutAction.actionPerformed(new ActionEvent(this, 0, null));
    } else {
        throw new IllegalStateException("handleAbout: about action is null");
    }
}
 
开发者ID:SQLPower,项目名称:power-matchmaker,代码行数:9,代码来源:OSXAdapter.java

示例10: handlePreferences

import com.apple.eawt.ApplicationEvent; //导入依赖的package包/类
public void handlePreferences(ApplicationEvent ae) {
    if (prefsAction != null) {
        ae.setHandled(true);
        prefsAction.actionPerformed(new ActionEvent(this, 0, null));
    } else {
        throw new IllegalStateException("handlePreferences: prefs action is null");
    }
}
 
开发者ID:SQLPower,项目名称:power-matchmaker,代码行数:9,代码来源:OSXAdapter.java

示例11: handleQuit

import com.apple.eawt.ApplicationEvent; //导入依赖的package包/类
public void handleQuit(ApplicationEvent ae) {
    if (quitAction != null) {
        /*  
        /   You MUST setHandled(false) if you want to delay or cancel the quit.
        /   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.
        */
        ae.setHandled(false);
        quitAction.actionPerformed(new ActionEvent(this, 0, null));
    } else {
        throw new IllegalStateException("handleQuit: quit action is null");
    }
}
 
开发者ID:SQLPower,项目名称:power-matchmaker,代码行数:16,代码来源:OSXAdapter.java

示例12: handleAbout

import com.apple.eawt.ApplicationEvent; //导入依赖的package包/类
@Override
public void handleAbout(ApplicationEvent event) {
    AboutBox myBox = new AboutBox(parent, true);
    //myBox.setSize(290, 310);
    myBox.setVisible(true);
    
    event.setHandled(true);
}
 
开发者ID:CIRDLES,项目名称:ET_Redux,代码行数:9,代码来源:MacOSAboutHandler.java

示例13: handlePreferences

import com.apple.eawt.ApplicationEvent; //导入依赖的package包/类
@Override
    public void handlePreferences(ApplicationEvent ae) {
        if (mainApp != null) {
//			mainApp.preferences();
            ae.setHandled(true);
        } else {
            throw new IllegalStateException("handlePreferences: MyApp instance " +
                                                        "detached from listener");
        }
    }
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:11,代码来源:OSXAdapter.java

示例14: handlePreferences

import com.apple.eawt.ApplicationEvent; //导入依赖的package包/类
@Override
public void handlePreferences(ApplicationEvent ae) {
    if (mainApp != null) {
        mainApp.preferences();
        ae.setHandled(true);
    } else {
        throw new IllegalStateException("handlePreferences: MyApp instance " + "detached from listener");
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:10,代码来源:OSXAdapter.java

示例15: handleAbout

import com.apple.eawt.ApplicationEvent; //导入依赖的package包/类
public void handleAbout(ApplicationEvent e) {
    if (aboutBox == null) {
        aboutBox = new MacAboutBox();
    }
    LOG.info("Got About describeChange");
    aboutBox.setResizable(false);
    aboutBox.setVisible(true);
    e.setHandled(true);
}
 
开发者ID:gocd,项目名称:gocd,代码行数:10,代码来源:GoMacLauncher.java


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