Java Screen Center getCenteredLocation(Window w)

Here you can find the source of getCenteredLocation(Window w)

Description

get Centered Location

License

Open Source License

Declaration

public static Point getCenteredLocation(Window w) 

Method Source Code


//package com.java2s;

import java.awt.*;

public class Main {
    public static Point getCenteredLocation(Window w) {
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
        int x = d.width - (d.width / 2 + w.getWidth() / 2);
        int y = d.height - (d.height / 2 + w.getHeight() / 2);
        Point p = new Point(x, y);
        return p;
    }//from  w ww  .  j  av a  2s .c  o m
}

Related

  1. centreOnScreen(Window frame)
  2. centreOnScreen(Window win)
  3. getCenter(Component owner, Dimension size)
  4. getCenterCoordinates(Dimension d)
  5. getCenteredLocation(Component comp)
  6. getCenteredLocation(Window window)
  7. getCenteringPoint(Dimension size)
  8. getCenteringPoint(final Dimension frameDimension)
  9. getCenteringPointOnScreen(Dimension dimension)