Jump to content

new JFrame position

- - - - -

  • Please log in to reply
3 replies to this topic

#1
alix

alix

    Newbie

  • Members
  • PipPip
  • 28 posts
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?

#2
alix

alix

    Newbie

  • Members
  • PipPip
  • 28 posts
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

#3
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
i'm not sure, but setLocation(x, y) looks promising.

#4
alix

alix

    Newbie

  • Members
  • PipPip
  • 28 posts
exactly! :)




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users