Java Screen Center setLocationToCenter(Window window)

Here you can find the source of setLocationToCenter(Window window)

Description

Sets the given Window to the center of the sceen

License

Open Source License

Parameter

Parameter Description
window to set to the screen center

Declaration

public static void setLocationToCenter(Window window) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.*;

public class Main {
    /**//from  ww  w.ja  v a2 s.c om
     * Sets the given {@link Window} to the center of the sceen
     * 
     * @param window to set to the screen center
     */
    public static void setLocationToCenter(Window window) {
        window.setLocationRelativeTo(null);
    }
}

Related

  1. setCenterLocation(final Window window)
  2. setCenterPosition(final Frame frame)
  3. setComponentLocationOnCenter(Component component)
  4. setLocationCentral(final Component component)
  5. setLocationOnScreenToCenteredWithin(java.awt.Window window, java.awt.Component root)
  6. setSizeAndCenterOnSreen(Window window, double widthFactor, double heightFactor)
  7. setupImage(BufferedImage image, int centerPos, int size, int maxSizePercentage)
  8. setWindowToCenterOfScreen(Window frm)
  9. setWindowToScreenCenter(Window window)