OSX Lion上的Java应用程序的全屏功能 [英] Fullscreen feature for Java Apps on OSX Lion

查看:127
本文介绍了OSX Lion上的Java应用程序的全屏功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何(本机地)在Java应用程序中实现OSX Lion的全屏功能?

How can I (natively) implement the fullscreen feature of OSX Lion in a Java application?

当前给出的答案包含了实现排序的好方法 - 全屏功能。我已经读过Eclipse可能能够使用Lion的原生全屏功能。这就是我要问的问题。

The current answers given incorporate a good method for achieving a sort-of-fullscreen feature. I've read that Eclipse may be able to use the "native" fullscreen feature of Lion. That's what I'm asking about.

推荐答案

我在Apple的Java发行说明中发现了这一点:

I found this on Apple's Java release notes:

Mac OS X 10.7 Lion全屏支持

Mac OS X 10.7 Lion Fullscreen Support

Lion上的Java应用程序现在可以选择进入每个窗口的全屏窗口功能。开发人员可以使用 com.apple.eawt.FullScreenUtilities 类将窗口标记为可以完全筛选,以及 com.apple.eawt.Application.requestToggleFullScreen(Window)以编程方式请求窗口进入和退出全屏模式的方法。此API在Mac OS X 10.6 Snow Leopard上不执行任何操作。

Java applications on Lion can now opt into the Fullscreen window feature per-window. Developers can use the com.apple.eawt.FullScreenUtilities class to mark windows as able to be full screened, and the com.apple.eawt.Application.requestToggleFullScreen(Window) method to programmatically request the window enter and exit full screen mode. This API does nothing on Mac OS X 10.6 Snow Leopard.

更明确地说,尝试从 JFrame s ...

More explicitly, try calling this early on from the constructor of your JFrames...

/**
 * @param window
 */
@SuppressWarnings({"unchecked", "rawtypes"})
public static void enableOSXFullscreen(Window window) {
    Preconditions.checkNotNull(window);
    try {
        Class util = Class.forName("com.apple.eawt.FullScreenUtilities");
        Class params[] = new Class[]{Window.class, Boolean.TYPE};
        Method method = util.getMethod("setWindowCanFullScreen", params);
        method.invoke(util, window, true);
    } catch (ClassNotFoundException e1) {
    } catch (Exception e) {
        log.log(Level.WARNING, "OS X Fullscreen FAIL", e);
    }
}

这篇关于OSX Lion上的Java应用程序的全屏功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆