List of usage examples for java.awt Window getX
public int getX()
From source file:Main.java
public static Point getPointForCentering(Dialog dialog, Window parent) { Dimension size = dialog.getSize(); Dimension parentSize = parent.getSize(); int centerX = (int) ((parentSize.getWidth() - size.getWidth()) / 2 + parent.getX()); int centerY = (int) ((parentSize.getHeight() - size.getHeight()) / 2 + parent.getY()); return new Point(centerX, centerY); }
From source file:Main.java
/** * A version of setLocationRelativeTo() that takes the maximum window bounds into account * (taskbar).//ww w . j a v a 2 s . co m */ public static void setLocationRelativeTo(Window window, Component component) { window.setLocationRelativeTo(component); Point screenLocation = getCurrentScreenLocation(window); if (window.getX() < screenLocation.x) window.setLocation(screenLocation.x, window.getY()); if (window.getY() < screenLocation.y) window.setLocation(window.getX(), screenLocation.y); }
From source file:Main.java
/** * @param owner/*from w w w. ja v a 2 s.c o m*/ * @param newConfigDialog */ public static void centerRelative(java.awt.Window main, java.awt.Window child) { java.awt.Dimension dim = main.getSize(); Point _loc = center(dim, child); // Move the window _loc.translate(main.getX(), main.getY()); child.setLocation(_loc); }