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
Printable View
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
//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);
use component.setLocaton(int x, int y)