One of the first places I look for any questions about Swing is a book by Matthew Robinson called, appropriately enough, Swing. You can find it online at http://manning.spindoczine
Most likely, the part you're missing is setting your weight and fill values in the GridBagConstraints. If weight is 1, you'll fill up the grid cell you're in. If weight is 0, you'll use the preferred size of the component (which is why you're in the center only). If fill is set to GridBagConstraints.BOTH, you'll expand to completely fill the container you're in (ie a JPanel or JFrame) both horizontally and vertically.
GridBagLayout is an extremely difficult layout to figure out. However, once you do it is also extremely powerful. Read through the example in the Swing book and see if that helps any. If not, feel free to post some code and I'll see if I can spot the problem. Good luck.
Main Topics
Browse All Topics





by: s_laviePosted on 2002-07-31 at 03:50:34ID: 7190198
http://java.sun.com/docs/b ooks/tutor ial/uiswin g/layout/ g ridbag.htm l