Maximize a FrameTag(s): AWT
// place this in the Frame constructor, after the show() this.move(0,0); resize(Toolkit.GetDefaultToolkit().getScreenSize());
frame.setState(Frame.ICONIFIED); // minimize the frame
JDK1.4
import java.awt.*; ... GraphicsDevice device; Frame frame = new Frame(); device = GraphicsEnvironment. getLocalGraphicsEnvironment(). getDefaultScreenDevice(); if ( device.isFullScreenSupported() ) { device.setFullScreenWindow(frame); } else { System.err.println("Full screen not supported"); }
import java.awt.*; class ScreenRes { public static void main(String args[]) { new ScreenRes().doit(); } public void doit() { Frame frame = new Frame(); GraphicsDevice device; device = GraphicsEnvironment. getLocalGraphicsEnvironment(). getDefaultScreenDevice(); if ( device.isFullScreenSupported() ) { device.setFullScreenWindow(frame); if (device.isDisplayChangeSupported()) { device.setDisplayMode( new DisplayMode( 1024, 768, 8, // bitDepth - 8 bits 256 colors DisplayMode.REFRESH_RATE_UNKNOWN )); } else { System.err.println("Change display mode not supported"); } } else { System.err.println("Full screen not supported"); } } }
To remove (manually) the "exclusive mode" on the JFrame :
device.setFullScreenWindow(null);
SWING jdk1.3
JFrame frame = new JFrame(); frame.setExtendedState(Frame.MAXIMIZED_BOTH); // can be // frame.setExtendedState(Frame.MAXIMIZED_HORIZ); // frame.setExtendedState(Frame.MAXIMIZED_VERT);