Results 1 to 3 of 3
  1. #1
    happiocholloh is offline Member
    Join Date
    Jan 2012
    Posts
    10
    Rep Power
    0

    Default gridbaglayout question

    Im learning how to use the gridbag layout, so far have got 8 JLabels underneath each other.

    Have set the gridy's respectively, but...

    The labels are all in the middle of the JFrame and are justified to the center like a tree.

    What am I missing, I thought that if you set the gridx to 0 it would start from topleft?

    How can I justify everything to the left?

    Im guessing this is school boy stuff otherwise i can paste my code

  2. #2
    camickr is online now Senior Member
    Join Date
    Jul 2009
    Posts
    1,233
    Rep Power
    6

    Default Re: gridbaglayout question

    See: How to Use GridBagLayout (The Java™ Tutorials > Creating a GUI With JFC/Swing > Laying Out Components Within a Container)

    Look for the section that explains how the weightx, weighty constraints work.

  3. #3
    happiocholloh is offline Member
    Join Date
    Jan 2012
    Posts
    10
    Rep Power
    0

    Default Re: gridbaglayout question

    Ha,
    Got it! Thankyou, theres a reason its Persistence java. The semi colon sent me into a coma. You can quote me on that!

Similar Threads

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