aspose file tools
The moose likes Swing / AWT / SWT and the fly likes GridaBagLayout and Container Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "GridaBagLayout and Container" Watch "GridaBagLayout and Container" New topic

GridaBagLayout and Container

Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
In my applet, I use GridBagLayout. When applet loads, the components in the applet are not positioned all the way at the edges of the container. Another words there is a margin off the top and left sides. I do position all of my components at (0,0). So what causes margin to appear?

All right brain, you don't like me and I don't like you, but let's just do this one thing so I can get back to killing you with beer.<br /> <br />- Homer Simpson
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
try specifying the anchor: c.anchor = GridBagConstraints.NORTHWEST;
and specify the filling: c.fill = GridBagConstraints.HORIZONTAL;
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: GridaBagLayout and Container