本文整理匯總了Java中com.apple.eawt.Application類的典型用法代碼示例。如果您正苦於以下問題:Java Application類的具體用法?Java Application怎麽用?Java Application使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Application類屬於com.apple.eawt包,在下文中一共展示了Application類的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: addAboutMenu
import com.apple.eawt.Application; //導入依賴的package包/類
private void addAboutMenu(final JMenu parentMenu, final Color backgroundColor) {
final String text = "<h2>" + gameData.getGameName() + "</h2>"
+ "<p><b>Engine Version:</b> "
+ ClientContext.engineVersion()
+ "<br><b>Game:</b> " + gameData.getGameName()
+ "<br><b>Game Version:</b> " + gameData.getGameVersion() + "</p>"
+ "<p>For more information please visit,<br><br>"
+ "<b><a hlink='" + UrlConstants.TRIPLEA_WEBSITE + "'>" + UrlConstants.TRIPLEA_WEBSITE + "</a></b><br><br>";
final JEditorPane editorPane = new JEditorPane();
editorPane.setBorder(null);
editorPane.setBackground(backgroundColor);
editorPane.setEditable(false);
editorPane.setContentType("text/html");
editorPane.setText(text);
final JScrollPane scroll = new JScrollPane(editorPane);
scroll.setBorder(null);
if (!SystemProperties.isMac()) {
parentMenu.addSeparator();
parentMenu.add(SwingAction.of("About", e -> JOptionPane.showMessageDialog(null, editorPane,
"About " + gameData.getGameName(), JOptionPane.PLAIN_MESSAGE))).setMnemonic(KeyEvent.VK_A);
} else { // On Mac OS X, put the About menu where Mac users expect it to be
Application.getApplication().setAboutHandler(paramAboutEvent -> JOptionPane.showMessageDialog(null, editorPane,
"About " + gameData.getGameName(), JOptionPane.PLAIN_MESSAGE));
}
}
示例6: setupOsxDockIconBadge
import com.apple.eawt.Application; //導入依賴的package包/類
/**
* Setup the OS X dock icon badge handler.
*/
private void setupOsxDockIconBadge() {
//setup the badge support for displaying active downloads
Listener.addListener(new Listener(new int[]{
Listener.EREIGNIS_START_EVENT, Listener.EREIGNIS_LISTE_DOWNLOADS}, MediathekGui.class.getSimpleName()) {
@Override
public void ping() {
final int activeDownloads = daten.getDownloadInfos().downloadStarts[4];
final Application application = Application.getApplication();
if (activeDownloads > 0) {
application.setDockIconBadge(String.valueOf(activeDownloads));
if (osxProgressIndicatorThread == null) {
osxProgressIndicatorThread = new OsxIndicatorThread();
osxProgressIndicatorThread.start();
}
} else {
application.setDockIconBadge("");
if (osxProgressIndicatorThread != null) {
osxProgressIndicatorThread.interrupt();
osxProgressIndicatorThread = null;
}
}
}
});
}
示例7: 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();
}
示例8: 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);
}
示例9: 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) {
}
}
示例10: 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);
});
}
示例11: 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();
}
});
}
示例12: registerMacShutdownHandler
import com.apple.eawt.Application; //導入依賴的package包/類
public static void registerMacShutdownHandler(final LobbyFrame frame) {
Application.getApplication().setQuitHandler((quitEvent, quitResponse) -> {
if (frame != null) {
frame.shutdown();
} else {
System.exit(0);
}
});
}
示例13: 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();
}
});
}
示例14: setCurrentAppIcon
import com.apple.eawt.Application; //導入依賴的package包/類
/**
* Use this method to set the icon for this app. Best used after JOGL stole
* the application icon. Bad JOGL!
*
* @param pFinalIcon
* final icon
*/
public static void setCurrentAppIcon(final Image pFinalIcon)
{
if (pFinalIcon == null)
return;
final String os = System.getProperty("os.name").toLowerCase();
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
if (os.indexOf("mac") >= 0)
{
Application.getApplication()
.setDockIconImage(pFinalIcon);
}
/*else if (os.indexOf("win") >= 0)
{
// not yet clear
}
else
{
// not yet clear
}/**/
}
});
}
示例15: 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));
}
}