Results 1 to 4 of 4
  1. #1
    matt20687 is offline Member
    Join Date
    Jun 2012
    Posts
    5
    Rep Power
    0

    Default Stopping JFrames from repositioning

    Hello,

    Is anyone able to help?

    I have created a tool for my colleagues to use, this tool has a fair few frames that the user will go through using links to other pages. At the moment i cannot figure out how i stop the window from repositioning each time a new frame is opened. It just defaults to the top left had corner of the desktop.

    Is there any way that i can make it remember the last position of the frame and keep it the same when the next frame is opened?

    Thanks in advance.

    Matt

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,965
    Rep Power
    8

    Default Re: Stopping JFrames from repositioning

    You can get the position of one JFrame and set the position of another JFrame.

    But this sounds like a job for CardLayout instead of multiple JFrames.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    matt20687 is offline Member
    Join Date
    Jun 2012
    Posts
    5
    Rep Power
    0

    Default Re: Stopping JFrames from repositioning

    Sorry i am not familiar with CardLayouts. I have created around 30 JFrames now so if possible it would be good if i could keep them, do you know how you can code this? I have looked on google but i cannot seem to make sense of any of it :(

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,965
    Rep Power
    8

    Default Re: Stopping JFrames from repositioning

    Check out the API for JFrame for useful functions. If you get stuck, post an SSCCE demonstrating exactly what you're confused about.

    But really, the solution is almost definitely to use a CardLayout. Google "java card layout" for tutorials on how to use it.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Disable repositioning of JFrame
    By divs1210 in forum AWT / Swing
    Replies: 14
    Last Post: 04-03-2011, 04:45 PM
  2. Button repositioning in JScrollPane
    By TrekSoft in forum AWT / Swing
    Replies: 4
    Last Post: 12-06-2010, 08:54 PM
  3. Objects repositioning automatically
    By ashish9590 in forum NetBeans
    Replies: 5
    Last Post: 06-30-2010, 12:10 PM
  4. repositioning
    By ashish9590 in forum NetBeans
    Replies: 2
    Last Post: 02-14-2010, 06:42 AM
  5. Repositioning An unwanted JInternalFrame
    By marco.c84 in forum AWT / Swing
    Replies: 8
    Last Post: 03-18-2009, 09:42 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
  •