Example usage for java.awt FileDialog getSize

List of usage examples for java.awt FileDialog getSize

Introduction

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

Prototype

public Dimension getSize() 

Source Link

Document

Returns the size of this component in the form of a Dimension object.

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);/*from  ww  w  .ja va  2 s  . co m*/
}