Here you can find the source of makeFullscreen(Frame frame, boolean attemptExclusiveMode)
isFullScreenSupported
returns true
.
public static void makeFullscreen(Frame frame, boolean attemptExclusiveMode)
//package com.java2s; //License from project: Apache License import java.awt.Frame; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Toolkit; public class Main { /**/*from ww w . j a v a 2 s. c o m*/ * Exclusive mode is only available if <code>isFullScreenSupported</code> * returns <code>true</code>. * * Exclusive mode implies: * <ul> * <li>Windows cannot overlap the full-screen window. All other application * windows will always appear beneath the full-screen window in the Z-order. * <li>There can be only one full-screen window on a device at any time, * so calling this method while there is an existing full-screen Window * will cause the existing full-screen window to * return to windowed mode. * <li>Input method windows are disabled. It is advisable to call * <code>Component.enableInputMethods(false)</code> to make a component * a non-client of the input method framework. * </ul> */ public static void makeFullscreen(Frame frame, boolean attemptExclusiveMode) { maximize(frame); frame.setUndecorated(true); frame.setLocation(0, 0); frame.setResizable(false); if (attemptExclusiveMode) { GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); gd.setFullScreenWindow(frame); } } public static void maximize(Frame frame) { Toolkit toolkit = Toolkit.getDefaultToolkit(); frame.setSize((int) toolkit.getScreenSize().getWidth(), (int) toolkit.getScreenSize().getHeight()); frame.setExtendedState(Frame.MAXIMIZED_BOTH); } }