Results 1 to 6 of 6

Thread: GridBag layout problems.{REsolved}

  1. #1

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Resolved GridBag layout problems.{REsolved}

    I'm trying to create a calculator using the gridbag layout, but I can't even get started. This layout managers keeps starting stuff in the direct center of the frame and wont put anything anywhere else. I tried this:

    c.anchor = GridBagConstraints.SOUTH;


    I just can't seem to get this thing working. Could you guys help me out. I hate to ask for some code, but it would really be helpful in this situation.
    Last edited by System_Error; Jul 14th, 2005 at 11:09 AM.

  2. #2
    Frenzied Member oceanebelle's Avatar
    Join Date
    Jun 2005
    Location
    my n00k.
    Posts
    1,064

    Re: GridBag layout problems.

    Could you place some code please?

  3. #3
    Frenzied Member oceanebelle's Avatar
    Join Date
    Jun 2005
    Location
    my n00k.
    Posts
    1,064

    Re: GridBag layout problems.

    I just might be able to help.

  4. #4
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Re: GridBag layout problems.

    Try
    Code:
    GridBagConstraints c = new GridBagConstraints();
    pane.add(theComponent, c.CENTER);

  5. #5
    Addicted Member
    Join Date
    May 2001
    Location
    UK
    Posts
    222

    Re: GridBag layout problems.

    One way would be to not use the hell that is GridBag Constraints, you could use spring layout if all you are after is a simple grid style approach, or write your won layout manager, they aren't that difficult, and give you much much better over the look and feel of your application...

  6. #6

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: GridBag layout problems.

    Thanks guys. I finally got this thing figured out. I just wanted to learn this thing, and to tell you the truth, I won't be coming back to the gridbag layout!! The gridbag layout starts putting everything in the center and when more components are added, it starts to fill out the frame. I really hate that stupid layout manager. Not as good as setbounds() in most ways.

Posting Permissions

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



Click Here to Expand Forum to Full Width