List of usage examples for java.awt FileDialog setLocation
@Override public void setLocation(int x, int y)
The method changes the geometry-related data.
From source file:Main.java
public static void centreDialogOnWindow(Window owner, FileDialog dialog) { Point ownerPosition = owner.getLocationOnScreen(); Dimension ownerSize = owner.getSize(); Dimension dialogSize = dialog.getSize(); int x = ownerPosition.x + (ownerSize.width / 2) - (dialogSize.width / 2); int y = ownerPosition.y + (ownerSize.height / 2) - (dialogSize.height / 2); dialog.setLocation(x, y); }