aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes GridBagLayout, & addComp() What are the parameters? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "GridBagLayout, & addComp() What are the parameters?" Watch "GridBagLayout, & addComp() What are the parameters?" New topic
Author

GridBagLayout, & addComp() What are the parameters?

Shawn Rieger
Greenhorn

Joined: Sep 05, 2005
Posts: 16
My confusion in in the addComp() function...

addComp(jlbl1, container, gbConst, 0, 0, 2, 1, 5, 1);

What are the last 6 parameters? Im assuming the first 2 ("0, 0,") are row and column. But when I add jlbl3 at ("1, 1") the label ends up at the top row right next to the first label. Im confused. And what are the rest of the parameters?

Any help out there?

Stephen Boston
Ranch Hand

Joined: Jul 14, 2005
Posts: 165
Ok, you've got the first two (Gridx and Gridy)
then there is gridwidth and gridheight followed by weightx and weighty.

From Sun:
GridBagConstraints

public GridBagConstraints(int gridx,
int gridy,
int gridwidth,
int gridheight,
double weightx,
double weighty,
int anchor,
int fill,
Insets insets,
int ipadx,
int ipady)

Creates a GridBagConstraints object with all of its fields set to the passed-in arguments. Note: Because the use of this constructor hinders readability of source code, this constructor should only be used by automatic source code generation tools.

Parameters:
gridx - The initial gridx value.
gridy - The initial gridy value.
gridwidth - The initial gridwidth value.
gridheight - The initial gridheight value.
weightx - The initial weightx value.
weighty - The initial weighty value.
anchor - The initial anchor value.
fill - The initial fill value.
insets - The initial insets value.
ipadx - The initial ipadx value.
ipady - The initial ipady value.


Sun has a very good tutorial on using GridBagLaout. How to use GridBagLayout

hth

Steve


Steve<br /> <br />No matter where you go, there you are.<br /> <br />"My evil self is at the door, and I have no power to stop it."
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GridBagLayout, & addComp() What are the parameters?