本文整理匯總了Java中com.apple.eawt.Application.getApplication方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.getApplication方法的具體用法?Java Application.getApplication怎麽用?Java Application.getApplication使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.apple.eawt.Application
的用法示例。
在下文中一共展示了Application.getApplication方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import com.apple.eawt.Application; //導入方法依賴的package包/類
public static void main(String[] args) {
AmidakujiMain amidakuji = new AmidakujiMain();
AmidakujiMain.width = 1080;
AmidakujiMain.height = 720;
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.title = "Amidakuji Version 0.4.3";
// cfg.useGL20 = true;
cfg.width = AmidakujiMain.width;
cfg.height = AmidakujiMain.height;
if(System.getProperty("os.name").toLowerCase().indexOf("mac os x") != -1) {
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Amidakuji");
Application app = Application.getApplication();
app.setDockIconImage(Toolkit.getDefaultToolkit().getImage(Main.class.getResource("/amidakuji_mac.png")));
} else {
cfg.addIcon("amidakuji.png", FileType.Internal);
cfg.addIcon("amidakuji_lin.png", FileType.Internal);
}
new LwjglApplication(amidakuji, cfg);
}
示例2: initializeMacOS
import com.apple.eawt.Application; //導入方法依賴的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();
}
});
}
}
示例3: integrate
import com.apple.eawt.Application; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public static void integrate()
{
try
{
Application appleEawtApplication = Application.getApplication();
appleEawtApplication.setDockIconImage(ImageIO.read(new URL(JavaFxHelper.buildResourcePath("icon.png"))));
appleEawtApplication.setEnabledAboutMenu(false);
appleEawtApplication.setAboutHandler(null);
appleEawtApplication.setEnabledPreferencesMenu(false);
appleEawtApplication.setPreferencesHandler(null);
}
catch (Throwable e)
{
e.printStackTrace();
}
}
示例4: main
import com.apple.eawt.Application; //導入方法依賴的package包/類
public static void main(String[] args) {
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("apple.awt.application.name", "Lambda");
InputStream imgStream = Main.class.getResourceAsStream("logo.png");
BufferedImage myImg = null;
try {
myImg = ImageIO.read(imgStream);
} catch (IOException e) {
System.out.println("Image not found");
}
JFrame app = new LambdaInterpreterGUI();
Application macApp = Application.getApplication();
macApp.setAboutHandler(aboutEvent -> JOptionPane.showMessageDialog(app, "Lambda Intrepeter By AUBRY DUBOIS POIVEY SCHERSACH", "About us", JOptionPane.PLAIN_MESSAGE));
macApp.setDockIconImage(myImg);
app.setIconImage(myImg);
app.setVisible(true);
}
示例5: install
import com.apple.eawt.Application; //導入方法依賴的package包/類
static void install() {
try {
Application app = Application.getApplication();
NbApplicationAdapterJDK8 al = new NbApplicationAdapterJDK8();
app.setAboutHandler(al);
app.setOpenFileHandler(al);
app.setPreferencesHandler(al);
app.setQuitHandler(al);
} catch (Throwable ex) {
ErrorManager.getDefault().notify(ErrorManager.WARNING, ex);
} finally {
}
NbApplicationAdapter.install();
}
示例6: uninstall
import com.apple.eawt.Application; //導入方法依賴的package包/類
static void uninstall() {
Application app = Application.getApplication();
app.setAboutHandler(null);
app.setOpenFileHandler(null);
app.setPreferencesHandler(null);
app.setQuitHandler(null);
}
示例7: AppleSupportImpl
import com.apple.eawt.Application; //導入方法依賴的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) {
}
}
示例8: initMac
import com.apple.eawt.Application; //導入方法依賴的package包/類
private void initMac() {
Application macApplication = Application.getApplication();
macApplication.setAboutHandler((AppEvent.AboutEvent ae) -> {
mActionManager.getAction(ActionManager.ABOUT).actionPerformed(null);
});
macApplication.setPreferencesHandler((AppEvent.PreferencesEvent pe) -> {
mActionManager.getAction(ActionManager.OPTIONS).actionPerformed(null);
});
}
示例9: OSXSetup
import com.apple.eawt.Application; //導入方法依賴的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();
}
});
}
示例10: OpenCardsWrapper4MacOSX
import com.apple.eawt.Application; //導入方法依賴的package包/類
public OpenCardsWrapper4MacOSX() {
// set some mac-specific properties
System.setProperty("apple.awt.graphics.EnableQ2DX", "true");
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "OpenCards");
oc = new OpenCards();
MacAppHandler macAppHandler = new MacAppHandler(oc);
// create an instance of the Mac Application class, so i can handle the
// mac quit event with the Mac ApplicationAdapter
Application macApplication = Application.getApplication();
// need to enable the preferences option manually
macApplication.setPreferencesHandler(macAppHandler);
macApplication.setAboutHandler(macAppHandler);
macApplication.setQuitHandler(macAppHandler);
macApplication.setQuitStrategy(QuitStrategy.CLOSE_ALL_WINDOWS);
macApplication.addAppEventListener(macAppHandler);
// display the jframe
SwingUtilities.invokeLater(new Runnable() {
public void run() {
oc.setVisible(true);
oc.doAfterSetup();
}
});
}
示例11: loadIcons
import com.apple.eawt.Application; //導入方法依賴的package包/類
private void loadIcons(ImageLoader imageLoader, GlobalSettings settings) {
List<Image> icons = imageLoader.loadIcons(settings);
setIconImages(icons);
if (settings.isOperationSystemMacOSX()) {
Application application = Application.getApplication();
application.setDockIconImage(findTheBiggest(icons));
}
}
示例12: loadIcons
import com.apple.eawt.Application; //導入方法依賴的package包/類
private static void loadIcons(JFrame jFrame) {
java.util.List<Image> icons = new ArrayList<Image>();
for(String iconPath: ICONS) {
URL iconURL = HelloWorld.class.getResource(iconPath);
ImageIcon icon = new ImageIcon(iconURL);
icons.add(icon.getImage());
}
jFrame.setIconImages(icons);
if(isOperationSystemMacOSX()) {
Application application = Application.getApplication();
application.setDockIconImage(icons.get(0));
}
}
示例13: MacBinder
import com.apple.eawt.Application; //導入方法依賴的package包/類
public MacBinder(Callbacks callbacks) {
super(callbacks);
application = Application.getApplication();
application.setQuitStrategy(QuitStrategy.SYSTEM_EXIT_0);
application.setQuitHandler(this);
}
示例14: setupUserInterfaceForOsx
import com.apple.eawt.Application; //導入方法依賴的package包/類
/**
* Setup the UI for OS X
*/
private void setupUserInterfaceForOsx() {
final Application application = Application.getApplication();
application.disableSuddenTermination();
application.setAboutHandler(aboutEvent -> showAboutDialog());
application.setPreferencesHandler(preferencesEvent -> showSettingsDialog());
application.setQuitHandler((quitEvent, quitResponse) -> {
if (!beenden(false, false)) {
quitResponse.cancelQuit();
} else {
quitResponse.performQuit();
}
});
//setup the MediathekView Dock Icon
try {
final URL url = this.getClass().getResource("/mediathek/res/MediathekView.png");
final BufferedImage appImage = ImageIO.read(url);
application.setDockIconImage(appImage);
} catch (IOException ex) {
Log.errorLog(165623698, "OS X Application image could not be loaded");
}
//Remove all menu items which don´t need to be displayed due to OS X´s native menu support
if (SystemInfo.isMacOSX()) {
//Datei->Beenden
jMenuDatei.remove(jSeparator2);
jMenuDatei.remove(jMenuItemBeenden);
//Datei->Einstellungen
jMenuDatei.remove(jMenuItemEinstellungen);
}
setupOsxDockIconBadge();
}
示例15: App
import com.apple.eawt.Application; //導入方法依賴的package包/類
/** Creates a new {@link App}. */
protected App() {
if (Platform.isMacintosh()) {
Application app = Application.getApplication();
app.setAboutHandler(AboutCommand.INSTANCE);
app.setPreferencesHandler(PreferencesCommand.INSTANCE);
app.setOpenFileHandler(OpenCommand.INSTANCE);
app.setPrintFileHandler(PrintCommand.INSTANCE);
app.setQuitHandler(QuitCommand.INSTANCE);
app.setQuitStrategy(QuitStrategy.SYSTEM_EXIT_0);
app.disableSuddenTermination();
}
}