File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion 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;
I agree. Here's the link:
subject: GridaBagLayout and Container
It's not a secret anymore!