Reputation: 806
my Java application is able to use fullscreen mode with mac thanks to this code:
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, myJFrame, true);
But this only enables fullscreen button at the right upper corner. Is it possible to go to fullscreen mode out of the application, as example by JButton-click?
It's only relevant for Mac OS X.
Thanks!
Upvotes: 0
Views: 1124
Reputation: 32650
If you're using OS X (10.7 and higher), you can use the native fullscreen mode. Use this method to request the window go on full screen mod :
com.apple.eawt.Application.getApplication().requestToggleFullScreen(window);
Where window
is your JFrame
for example.
EDIT : You can also see the example given by @trashgod in his comment.
Upvotes: 1