本文整理汇总了Java中org.simplericity.macify.eawt.DefaultApplication类的典型用法代码示例。如果您正苦于以下问题:Java DefaultApplication类的具体用法?Java DefaultApplication怎么用?Java DefaultApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultApplication类属于org.simplericity.macify.eawt包,在下文中一共展示了DefaultApplication类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.simplericity.macify.eawt.DefaultApplication; //导入依赖的package包/类
public void init() {
final Application app = new DefaultApplication();
if (!app.isMac()) {
logger.debug("Omitting Mac OS initialization, since operating system is not Mac OS");
return;
}
System.setProperty("apple.laf.useScreenMenuBar", "true");
app.addAboutMenuItem();
app.setEnabledAboutMenu(true);
app.addPreferencesMenuItem();
app.setEnabledPreferencesMenu(true);
app.addApplicationListener(new DCApplicationListener());
}
示例2: initAppleExtensions
import org.simplericity.macify.eawt.DefaultApplication; //导入依赖的package包/类
private void initAppleExtensions(Properties settings) throws Exception {
Application application = new DefaultApplication();
if (application.isMac()) {
application.addApplicationListener(this);
InputStream imageStream = getClass().getClassLoader().getResourceAsStream("META-INF/jettyconsole/background-image.jpg");
if (imageStream != null) {
BufferedImage image = ImageIO.read(imageStream);
BufferedImage icon = new BufferedImage(128, 128, BufferedImage.TYPE_INT_ARGB);
float imageRatio = (float) image.getWidth() / image.getHeight();
int width = imageRatio > 1 ? (int) (icon.getWidth() * imageRatio) : icon.getWidth();
int height = imageRatio < 1 ? (int) (icon.getHeight() / imageRatio) : icon.getHeight();
int x = icon.getWidth() / 2 - width / 2;
int y = icon.getHeight() / 2 - height / 2;
Graphics2D g2 = (Graphics2D) icon.getGraphics();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
RoundRectangle2D.Double rect = new RoundRectangle2D.Double(1, 1, 126, 126, 50, 50);
g2.setClip(rect);
g2.drawImage(image, x, y, width, height, null);
g2.setClip(0, 0, icon.getWidth(), icon.getHeight());
g2.setColor(Color.DARK_GRAY);
g2.draw(rect);
g2.dispose();
icon.flush();
application.setApplicationIconImage(icon);
}
}
}
示例3: doMacOSXIntegration
import org.simplericity.macify.eawt.DefaultApplication; //导入依赖的package包/类
protected static void doMacOSXIntegration()
{
Application a = new DefaultApplication();
a.addApplicationListener(new Launch());
a.addPreferencesMenuItem();
a.addAboutMenuItem();
}