Why use GridBagLayout when other easier to use layouts might work better? How about a simple BoxLayout?
Though myself, I'd not use AWT but would prefer Swing.
posted 10 years ago
Thanks for your advice,Pete! I tried BoxLayout for the controlPanel and it did the job perfectly. The reason I considered using AWT (not one of my favourites) was that I wanted to use an Applet to control a MySQL database I have registered with my web hoster, who limits the use of the database to scripts/apps/Applets located on the database host itself. Sounded like an Applet (or a couple of Applets for that matter) could do the job nicely meaning that to ensure browser acceptance I was forced to choose java.applet.Applet over javax.swing.JApplet ... Now I've come up with a scheme of using WebStart, thus enabling use of swing libraries.
But you're perfectly right that BoxLayout is the one to use for alignment of a single column of components on a panel.
Thanks for your efforts!
The man who sets out to carry a cat by its tail learns something that will always be useful and which never will grow dim or doubtful.
-- Mark Twain
Steffen Schmitt wrote:to ensure browser acceptance I was forced to choose java.applet.Applet over javax.swing.JApplet ...
Why? JApplet extends Applet, and the browser shouldn't care what the applet contains, as long as the JVM supports the code. If a browser supports Applet I don't see why it wouldn't support JApplet as well.