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.
Re: GridBag layout problems.
Could you place some code please? :D
Re: GridBag layout problems.
I just might be able to help. ;)
Re: GridBag layout problems.
Try
Code:
GridBagConstraints c = new GridBagConstraints();
pane.add(theComponent, c.CENTER);
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...
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.