Results 1 to 6 of 6
  1. #1
    ashish9590 is offline Member
    Join Date
    Feb 2010
    Posts
    7
    Rep Power
    0

    Default Objects repositioning automatically

    Im developing a swing application where in i have a login button on pressing which the username and password fields are setvisible.

    The problem is initially the button position is low.when i press it.. it moves upward and displays username n password fields.when i enter the wrong information the button moves further up n displays the message.

    Ive positioned button initially in the top position itself but its movin from bottom to top on each item setting visible.

    How could i make it stationary even if others are not visible.

    dont ask me to use layouts... im using a free design as it helps me easily position all my objects.

    waiting for a solution to stop this automatic repositiong in netbeans.
    thnq

  2. #2
    Sno's Avatar
    Sno
    Sno is offline Senior Member
    Join Date
    Apr 2010
    Posts
    195
    Rep Power
    5

    Default

    .. thats the problem with free design, it is free to move, you have to determine some sort of layout normally to allow things to work, or you do a trial and error to keep it stable.
    :rolleyes: ~ Sno ~ :rolleyes:
    '-~ B.S. Computer Science ~-'

  3. #3
    ashish9590 is offline Member
    Join Date
    Feb 2010
    Posts
    7
    Rep Power
    0

    Default

    well thanks....
    i managed to solve the issue using a different layout manager....

    but isnt ther any way to stop the automatic repositioning in the free design??

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

    Default

    I agree with Sno, learning the various layouts is certainly the way to go, and you've done well to take his advice to heart, learn how to use the layouts and solve your problem. The only other suggestion I can give is to consider placing unrelated components into different JPanels and then lay out the JPanels in a larger JPanel -- nest your JPanels. This can allow for more complex and yet easier to manage layouts.

    Best of luck!

  5. #5
    Prajin's Avatar
    Prajin is offline Senior Member
    Join Date
    Jun 2010
    Location
    Ktm, Nepal
    Posts
    120
    Rep Power
    0

    Default

    If you don't like layouts try 'setBounds()' with 'setLayout(null)'.

    It's always best to use layouts and panels.

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

    Default

    Quote Originally Posted by Prajin View Post
    If you don't like layouts try 'setBounds()' with 'setLayout(null)'.
    There are very few times when you'll need to do this, and by doing this you're taking on the responsibility of making sure that the GUI is proportioned correctly when the app is run on a computer with a different OS or video setting.

    It's always best to use layouts and panels.
    amen.

Similar Threads

  1. repositioning
    By ashish9590 in forum NetBeans
    Replies: 2
    Last Post: 02-14-2010, 07:42 AM
  2. creating objects by methods automatically
    By thedarlington in forum New To Java
    Replies: 13
    Last Post: 02-07-2010, 11:48 PM
  3. Automatically set the path
    By mlibot in forum New To Java
    Replies: 9
    Last Post: 01-26-2010, 09:18 AM
  4. Repositioning An unwanted JInternalFrame
    By marco.c84 in forum AWT / Swing
    Replies: 8
    Last Post: 03-18-2009, 10:42 PM
  5. Replies: 1
    Last Post: 01-22-2009, 05:25 PM

Tags for this Thread

Posting Permissions

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