Results 1 to 4 of 4
  1. #1
    bison is offline Member
    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0

    Default Getting window position

    Greetings!

    I have a parent window and a child window, but i want to create the child window in the center of the parent window. So, how can i get the coordinates of the parent window?

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,574
    Rep Power
    12

    Default

    Check out the java.awt.Component API docs for a method that gets the location of the component in screen coordinates. And java.awt.window for a method to set location relative to another component.

    -----------------------------

    There is a Swing/AWT forum on this site that is the place to get the most knowledgeable help. (But don't repost or things will get confusing.)

  3. #3
    bison is offline Member
    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0

    Default

    Can i get a componentListener on the parent frame, to check if its moved, and get the new coordinates? with something similar to getX()? But what?

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Replies: 4
    Last Post: 01-10-2010, 08:48 AM
  2. change url in parent window from child window
    By rakesh_n_mehta in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 07-09-2009, 01:17 PM
  3. how can i move one frame window to another window
    By santhosh_el in forum AWT / Swing
    Replies: 8
    Last Post: 06-10-2009, 04:36 PM
  4. get position in string from caret position
    By helloworld111 in forum AWT / Swing
    Replies: 5
    Last Post: 02-19-2009, 02:36 AM
  5. Help with position in java
    By fernando in forum New To Java
    Replies: 1
    Last Post: 07-31-2007, 08:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •