Java Screen Full Size fullScreen(Component component)

Here you can find the source of fullScreen(Component component)

Description

full Screen

License

Open Source License

Declaration

public static final void fullScreen(Component component) 

Method Source Code


//package com.java2s;
import java.awt.Component;
import java.awt.Dimension;

import java.awt.Frame;
import java.awt.Toolkit;

public class Main {

    public static final void fullScreen(Component component) {
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = component.getSize();

        if (frameSize.height > screenSize.height) {
            frameSize.height = screenSize.height;
        }/*from w  ww  . java  2s  .  co  m*/

        if (frameSize.width > screenSize.width) {
            frameSize.width = screenSize.width;
        }

        component.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
    }

    public static final void fullScreen(Frame frame) {
        frame.setExtendedState(Frame.MAXIMIZED_BOTH);
    }
}

Related

  1. fitInScreen(Component comp)
  2. fitInScreen(Window o)
  3. fitToScreen(Dimension size, GraphicsConfiguration screen)
  4. forceToScreen(Window window)
  5. fullScreen()
  6. fullScreen(Window window)
  7. getOppositeFullScreenBoundsFor(Rectangle r, boolean includeReservedInsets)
  8. initializeScreenArea(int priority)
  9. locateInScreenCenter(Component c)