0

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!

Gersee
  • 806
  • 3
  • 15
  • 30
  • possible duplicate of [Fullscreen feature for Java Apps on OSX Lion](http://stackoverflow.com/questions/6873568/fullscreen-feature-for-java-apps-on-osx-lion) – Eelke Aug 12 '14 at 17:42

1 Answers1

1

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.

blackbishop
  • 30,945
  • 11
  • 55
  • 76