本文整理汇总了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();
}
});
}
}
示例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);
}
示例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);
}
}
}
}
示例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");
}
}
示例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");
}
}
示例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");
}
}
示例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");
}
}
示例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);
}
示例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");
}
}
示例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");
}
}
示例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");
}
}
示例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);
}
示例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");
}
}
示例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");
}
}
示例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);
}