alanwilliamson

Layout Managers, sometimes you have to get your hands dirty

Last night I went through the hell of attempting to layout some controls on my JPanel. I'll freely admit, I was struggling. I was trying to use the Visual Editor for this and forcing myself not to drop to code. I failed. I wanted to layout some basic controls for a fairly mundane input dialogue box. I tried them all to see which one was going to offer me the easiest way of doing it. In my heart I knew I needed the GridBagLayout, but the UI wasn't permitting the sort of control and flexibility I was hoping for.

In the end I gave up. Resorted to hand coding the GridBagLayout positioning as I wished. For the HTML experts among you, laying out controls using GridBagLayout is very similar to how you would use an HTML table for positioning. If you find yourself struggling to get the look you are after, then think how you would do it with an HTML table and you'll be more than halfway there. GridBagConstraints gives you the sort of the control you would find in TD and TR tags of the HTML table.

It is a shame the Visual Editor let me down there, I was hoping that I could have done the whole thing via drag'n'drop. Visual Studio from Microsoft doesn't seem to suffer from the same short comings, allowing me to drag'n'drop with extreme ease to produce a layout that will work in all window sizes. Visual Editor has brought a huge boost to the Eclipse world, it still has a little way to go. I'll freely admit I have no idea what the likes of Borland and IntelliJ do in this arena.

Comments

Alan, Have a look at UICompiler for Java. A wonderfull piece of technology based on QtDesigner......

Klaasjan Tukker

left by Anonymous User — Friday, 9 April 2004 3:11 PM

I have found jgoodies.com Forms to be a very easy and comprehensive layout manager to work with. Works great for any kind of layout, is intuitive and very close to html table layouts. I find it to be a good deal easier than GridBagLayout. It is designed for form layout, but works just like an HTML table, you can do anything with it. best of luck.

doubtintom

left by Anonymous User — Friday, 9 April 2004 3:33 AM

Leave Comment

please note, all comments will be moderated for spam and abuse before being publicly posted.


 

Recent Cloud posts

Recent JAVA posts

Latest CFML posts


 
Site Links
Recommended Sites/Blogs