Results 1 to 3 of 3
  1. #1
    garrym is offline Member
    Join Date
    Apr 2011
    Posts
    28
    Rep Power
    0

    Default Help with layout managers

    Hi,

    I'm having trouble understanding how layout managers work. I understand how they work in principle but when it comes to managing the size of the layout and its contained components I'm at a loss.

    Here's an example:

    I have one panel with a BorderLayout. Inside this panel I have placed a label in NORTH and a button in the SOUTH. The lable needs to be in the centre of the panel or at least the centre of the space not taken by the button, and the button needs to be default height and take up the width of the container.

    If I run the project as it is, the button takes up half the container space and the lable keepsits default size and is placed in the middle of the available space. I have no idea why this is! Where's the consistency here?

    Thanks

  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,234
    Rep Power
    7

    Default Re: Help with layout managers

    Your code is wrong and we are not mind readers.

    Post your Short, Self Contained, Correct Example demonstrating the problem and maybe someone will be able to help.

  3. #3
    garrym is offline Member
    Join Date
    Apr 2011
    Posts
    28
    Rep Power
    0

    Default Re: Help with layout managers

    It's fine I've fixed it thanks

Similar Threads

  1. trouble with layout managers
    By yemista in forum AWT / Swing
    Replies: 3
    Last Post: 10-27-2011, 07:02 PM
  2. set button size in case of layout managers
    By silversurfer2in in forum AWT / Swing
    Replies: 3
    Last Post: 06-22-2010, 10:23 PM
  3. Why use layout managers in applet?
    By Splat in forum New To Java
    Replies: 2
    Last Post: 10-14-2009, 04:41 AM
  4. Multiple Layout Managers
    By AJG in forum New To Java
    Replies: 0
    Last Post: 04-06-2008, 01:43 AM
  5. Layout Managers
    By gmioannou in forum AWT / Swing
    Replies: 1
    Last Post: 12-24-2007, 04:12 AM

Posting Permissions

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