Click to See Complete Forum and Search --> : java


Werner Hutmacher
January 8th, 1999, 07:32 AM
hi,


does anybody know how to position a JFrame-Window in a java APPLICATION?

for example:

center the window in the middle of the screen.


thanks in advance


werner hutmacher

Zafir Anjum
January 8th, 1999, 10:01 AM
//Center frame

Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

Dimension size = frame.getSize();

screenSize.height = screenSize.height/2;

screenSize.width = screenSize.width/2;

size.height = size.height/2;

size.width = size.width/2;

int y = screenSize.height - size.height;

int x = screenSize.width - size.width;

frame.setLocation(x, y);

Nithyanand
October 11th, 1999, 07:04 PM
use component.setLocaton(int x, int y)