Full screen support under Windows and MacOS have different user expectations...
You could use Full screen exclusive mode on both, but Mac users have a different exceptions when it comes to full screen applications, as MacOS supports full screen applications at an OS level
I tested the following code (which is based on this example) on Mavericks with Java 8 and it works fine.
public static void enableOSXFullscreen(Window 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 (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | ClassNotFoundException ex) {
ex.printStackTrace();
}
}
public static void requestOSXFullscreen(Window window) {
try {
Class appClass = Class.forName("com.apple.eawt.Application");
Class params[] = new Class[]{};
Method getApplication = appClass.getMethod("getApplication", params);
Object application = getApplication.invoke(appClass);
Method requestToggleFulLScreen = application.getClass().getMethod("requestToggleFullScreen", Window.class);
requestToggleFulLScreen.invoke(application, window);
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
ex.printStackTrace();
}
}
One of the hardest hurdles you will have with users accepting your application is working with their current expectations. Do something they aren't use to and no matter how wonderful your app is, they won't like you for it (IMHO).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…