the idea is that when a new frame is created it's placed at the top left corner ( i would assume its placed at 0,0 )
is there a way to tell java to place the new frame at different coordinates? like to make it appear on the exact same coordinates as the current frame or something?
3 replies to this topic
#1
Posted 06 January 2011 - 12:53 PM
|
|
|
#2
Posted 06 January 2011 - 01:16 PM
static Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
static int w = 640;
static int h = 480;
static int x = (dim.width-w)/2;
static int y = (dim.height-h)/2;
that will place it in the center of the screen
static int w = 640;
static int h = 480;
static int x = (dim.width-w)/2;
static int y = (dim.height-h)/2;
that will place it in the center of the screen
#3
Posted 06 January 2011 - 02:04 PM
i'm not sure, but setLocation(x, y) looks promising.
#4
Posted 06 January 2011 - 02:23 PM
exactly! :)
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









