PDA

View Full Version : [Java] Gridbag layout width/columns



SpinningAround
August 17th, 2010, 07:12 AM
I'm started to work with Gridbaglayout but can't get more than four columns. If I try to add more than four items to one row will items only be added on top of each other. Is there a way to set or change number of columns?

PaulM1985
August 17th, 2010, 10:51 AM
If you are using GridBagLayout you should have a GridBagConstraints object with it. The cell position where you add your component is given by the values gridx and gridy in your GridBagConstraints object.

This page describes GridBagLayout and has an example of how to use it:

http://download.oracle.com/javase/1.5.0/docs/api/java/awt/GridBagLayout.html

Paul

lykeion
August 17th, 2010, 11:53 AM
Couldn't help myself:

http://madbean.com/anim/totallygridbag/

KdotJ
August 17th, 2010, 01:48 PM
Couldn't help myself:

http://madbean.com/anim/totallygridbag/

lol nice. I can feel the frustration lol