Reputation: 1957
I'm not sure how it is using other frameworks but this questions is strictly regarding Java swing.
Is it better to use a Visual Editor to place objects or to manually code the placement of the objects onto the frame (Layout managers or null layouts)?
From my experience I've had a lot of trouble using Visual editors when it comes to different screen resolutions or changing the window size. Using manual code to place objects I've found that my GUIs behave a lot better with regard to the screen size issue. However when I want to change a small part of my GUI it takes a lot more work compared to using a visual editor
Just wondering what people's thoughts were on this?
Upvotes: 2
Views: 462
Reputation: 56595
I personally have used over the years a lot of GUI designer - in Eclipse, NetBeans, IntelliJ. And I was never happy with the restrictions that they imposed and the code that they generated. In the end I had so much custom tweaks that using the designers hindered my work instead of assisting it. And then I found MigLayout - for me this piece of software is Godsend. It managed to take out the unneeded complexity out of my Swing labs and let me design superb layouts with minimum efforts. I don't think that MigLayout is harder to use(as someone above mentioned) - it's certainly to harder to use than CSS.
Even if you don't like MigLayout, my advice is to stay away from GUI designers. A simpler alternative of MigLayout is JGoodies Forms Layout(which MiG supercedes), jide-oss features some nice simple layouts as well. If you want to use a designer, however, my advice would be - IntelliJ IDEA Forms designer + JGoodies Forms - imo it generates much more maintainable code then say NetBeans Matisse.
Upvotes: 1
Reputation: 10519
I never use a visual builder for my Swing UIs.
The ease to build a new UI generally becomes a pain point during software maintenance: some builders can't easily modify existing screens (in particular if they have been manually modified for some good reason); imposing a GUI builder to the people in charge of maintaining your software generally also means imposing their IDE as well, people may lack productivity if they have to use an IDE they are not used to or, worse, that they don't like.
Of course, manually building UIs comes at a cost: understanding the complexity of various LayoutManagers. However, there is a broad range of Swing LayoutManagers out there (mostly open source), some being both easy to use (and maintain) and powerful.
Two examples:
One additional point: NEVER use absolute position/size in your UIs, this is looking for problems (your UIs may be truncated on some monitors/systems...)
Upvotes: 5
Reputation: 205805
You need to develop skill with both: one will always be faster than the other for some particular task. Having said that, without some manual skill, a designer will slow you down.
Upvotes: 2
Reputation: 2402
Personally i use layout managers over visual editors, the result is more readable, maintainable code. Also, you're not tied to any specific visual editor which may change (or stop being supported).
Upvotes: 1