Java Screen Size setSize(final Window window, final int minusX, final int minusY)

Here you can find the source of setSize(final Window window, final int minusX, final int minusY)

Description

set Size

License

Apache License

Declaration

static void setSize(final Window window, final int minusX, final int minusY) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.Dimension;

import java.awt.Toolkit;
import java.awt.Window;

public class Main {
    static void setSize(final Window window, final int minusX, final int minusY) {
        final Toolkit toolkit = Toolkit.getDefaultToolkit();
        final Dimension screenSize = toolkit.getScreenSize();
        final double screenWidth = screenSize.getWidth();
        final double screenHeight = screenSize.getHeight();
        final Dimension size = new Dimension((int) (screenWidth - minusX), (int) (screenHeight - minusY));
        window.setBounds(minusX / 2, minusY / 2, size.width, size.height);
        window.setPreferredSize(size);//from   w w w  .  ja va 2s . co m
    }
}

Related

  1. getWindowActualSize(final Window window)
  2. makeEllipse(double x, double y, double size)
  3. maximizeWindowWithMargin(final Window window, final int margin, final Dimension maxSize)
  4. screenSize()
  5. setLocationRelativeToAndSizeToWindow(Component parent, Component child, Dimension max)
  6. setSize(Window window, double widthFactor, double heightFactor)
  7. setWindowDesktopSize(Window window, double sizeX, double sizeY)
  8. setWindowSize(final Window w, final Rectangle r)
  9. sizeForScreen(Component component)