Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Layout Managers

  1. #1
    Member
    Join Date
    May 2013
    Posts
    42
    Thanks
    0
    Thanked 5 Times in 1 Post

    Default Layout Managers

    Hey, so I'm making this program, and I want it to be laid out a certain way, but I'm not sure how to do this, seeing as this is the first time I've made a GUI with java.

    Here is what I have at the minute:
    1.jpg

    Here is what I want:
    2.jpg

    Obviously I don't have the painting working yet, but which layout manager would I use to get this sort of layout?


  2. #2
    Member Kewish's Avatar
    Join Date
    Apr 2013
    Location
    Australia
    Posts
    116
    Thanks
    10
    Thanked 17 Times in 14 Posts

    Default Re: Layout Managers

    JFrame by default is BorderLayout. You want to add the painting JPanel to BorderLayout.CENTER.

    JPanels default is FlowLayout so add all your components for user interaction to a JPanel and add that panel to the frames BorderLayout.SOUTH.

    That should give you what you want. The Oracle tutes site has a visual guide to Layout Managers. Here's a link A Visual Guide to Layout Managers

  3. #3
    Member
    Join Date
    May 2013
    Posts
    42
    Thanks
    0
    Thanked 5 Times in 1 Post

    Default Re: Layout Managers

    okay thanks a lot, ill have a try at it!

Similar Threads

  1. GUI Layout - Does anyone know how to set a layout?
    By mikemontesa in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 20th, 2013, 04:35 PM
  2. Help with Group Layout
    By GoPro in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 1st, 2012, 09:34 PM
  3. Is there a layout for this?
    By gkffjcs in forum AWT / Java Swing
    Replies: 2
    Last Post: September 27th, 2011, 09:15 AM
  4. Replies: 1
    Last Post: April 14th, 2011, 07:50 AM
  5. Grid bag layout inside grid bag layout
    By kiddkoder in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 29th, 2011, 08:07 AM