Example usage for java.awt FileDialog setLocation

List of usage examples for java.awt FileDialog setLocation

Introduction

In this page you can find the example usage for java.awt FileDialog setLocation.

Prototype

@Override
public void setLocation(int x, int y) 

Source Link

Document

The method changes the geometry-related data.

Usage

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);
}