List of utility methods to do Screen Full Size
void | fullScreen() full Screen Robot robot = null; try { robot = new Robot(); } catch (AWTException e) { e.printStackTrace(); robot.setAutoDelay(80); robot.mouseMove(500, 500); ... |
void | fullScreen(Component component) full Screen Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = component.getSize(); if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; component.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); |
void | fullScreen(Window window) full Screen Dimension dimScreen = window.getToolkit().getScreenSize(); window.setLocation(-4, -4); window.setSize(dimScreen.width + 8, dimScreen.height + 8); |
Rectangle | getOppositeFullScreenBoundsFor(Rectangle r, boolean includeReservedInsets) get Opposite Full Screen Bounds For GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); TreeMap<Integer, Rectangle> prioMap = new TreeMap<Integer, Rectangle>(); for (GraphicsDevice dev : ge.getScreenDevices()) { Rectangle bounds; if ((!includeReservedInsets) && dev == ge.getDefaultScreenDevice()) { bounds = ge.getMaximumWindowBounds(); } else { bounds = dev.getDefaultConfiguration().getBounds(); ... |
void | initializeScreenArea(int priority) If you use methods such as #ensureOnScreen(java.awt.Rectangle) , #getContainingScreenBounds(java.awt.Rectangle,boolean) or #getScreenArea() for the first time, it will take up to a couple of seconds to run because it needs to get device information. final Thread _initializationThread = new Thread() { @Override public void run() { GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); }; _initializationThread.setPriority(priority); if (INITIALIZE_SCREEN_AREA_USING_THREAD) { ... |
void | locateInScreenCenter(Component c) locate In Screen Center Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); c.setLocation((screenDim.width - c.getWidth()) / 2, (screenDim.height - c.getHeight()) / 2); |
void | locateOnOpticalScreenCenter(Component component) Locates the given component on the screen's center. Dimension paneSize = component.getSize();
Dimension screenSize = component.getToolkit().getScreenSize();
component.setLocation((screenSize.width - paneSize.width) / 2,
(int) ((screenSize.height - paneSize.height) * 0.45));
|
void | setFrameToMiddleOfTheScreen(Window window) Sets the given Window to the middle of the screen. Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int screenMiddleX = screenSize.width / 2; int screenMiddleY = screenSize.height / 2; int x = screenMiddleX - (window.getWidth() / 2); int y = screenMiddleY - (window.getHeight() / 2); window.setBounds(x, y, window.getWidth(), window.getHeight()); |
void | setWindowCanFullScreen(Window w, boolean flag) set Window Can Full Screen |
void | showOnSameScreenAsMouseCenter(Container frame) show On Same Screen As Mouse Center Point mouseLocation = MouseInfo.getPointerInfo().getLocation(); GraphicsDevice device; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice lstGDs[] = ge.getScreenDevices(); ArrayList<GraphicsDevice> lstDevices = new ArrayList<GraphicsDevice>(lstGDs.length); for (GraphicsDevice gd : lstGDs) { GraphicsConfiguration gc = gd.getDefaultConfiguration(); Rectangle screenBounds = gc.getBounds(); ... |