Sep 30

The GraphicsDevice class has a method setFullScreenWindow() that allows you to specify the window to display in full screen mode on that device.


JFrame frame = new JFrame();

GraphicsEnvironment environment = 
   GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] devices = 
   environment.getScreenDevices();

// we will assume the screen of interest is the 1st one

GraphicDevice device = devices[0];   
if (device.isFullScreenSupported())
{

   // make frame undecorated and not resizeable

   frame.setUndecorated(true);
   frame.setResizable(false);

   // go into full screen mode

   device.setFullScreenWindow(frame);
   frame.validate();
} 

written by objects \\ tags:


Leave a Reply

You must be logged in to post a comment.