Results 1 to 4 of 4

Thread: GridBagLayout

  1. #1
    ginger0001 is offline Member
    Join Date
    Mar 2012
    Posts
    7
    Rep Power
    0

    Question GridBagLayout

    how to create a GridBagLayout on JPanel with 2 rows but different size
    First row is smaller than the second row(First and second row are JPanel)

    I will add small JLabel on first row and add JScrollBar on the second panel
    Please help me
    Last edited by ginger0001; 03-26-2012 at 06:27 PM.

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

    Default Re: GridBagLayout

    Please don't post multiple copies of the same question. I've deleted your other thread. I'm also moving this to the Swing forum.

    Recommended reading: Lesson: Laying Out Components Within a Container (The Java™ Tutorials > Creating a GUI With JFC/Swing)
    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
    sehudson's Avatar
    sehudson is offline Senior Member
    Join Date
    Mar 2010
    Posts
    340
    Rep Power
    5

    Default Re: GridBagLayout

    GridBagLayout is pretty easy to pickup. From what you are describing, you may not need that type of layout, but here is a good example program using GridBagLayout:

    http://www.iam.ubc.ca/guides/javatut...BagWindow.java

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: GridBagLayout

    Quote Originally Posted by sehudson View Post
    ... here is a good example program using GridBagLayout:
    The Oracle tutorial trail linked by Kevin addresses the matter of choice of layout, and a tutorial trumps a nominally commented source code any day.

    And that class is a really bad example of Swing coding.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. GridBagLayout.... help!!!!
    By eiramae in forum Java Applets
    Replies: 5
    Last Post: 02-26-2011, 03:19 PM
  2. GridBagLayout Help
    By Zman3359 in forum AWT / Swing
    Replies: 0
    Last Post: 02-21-2011, 08:39 PM
  3. [AWT] GridBagLayout Help.
    By Sandia_man in forum AWT / Swing
    Replies: 2
    Last Post: 05-23-2010, 08:54 PM
  4. help with gridbaglayout
    By robertbob in forum AWT / Swing
    Replies: 5
    Last Post: 05-18-2010, 04:14 AM
  5. GridBagLayout
    By carderne in forum New To Java
    Replies: 8
    Last Post: 01-25-2009, 02:06 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
  •