954,178 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Beware the GUI builder

http://www.hacknot.info/hacknot/action/showEntry?eid=76 has an excellent rant about the problems of visual editors (aka GUI builders).

While he talks specifically about Java, the same holds true for all of them. And yes, that means Visual BASIC and Delphi as well, languages which traditionally are seen as almost purely visual.
I've done several midsized Delphi applications and in all of them I ended up writing custom code to manipulate the screen layout and content on the fly, something GUI builders have always promised to make a thing of the past but fail to deliver.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

Hi everyone,

Fantastic article

Richard West

freesoft_2000
Practically a Master Poster
623 posts since Jun 2004
Reputation Points: 25
Solved Threads: 10
 

There's no use; these lazy turds won't change, and won't ever know that JEdit owns all IDE's.

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

VI baby, VI :mrgreen: :cheesy::cool: (though I use JBuilder myself, but not before I could do everything by hand that JBuilder can do for me).

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

I'm curious as to how it lays the code out for you. Does it still follow the right form in which you want? I remember when I was like 12 and "trying" to learn VB.NET(failed miserably), I thought that was the coolest thing in the world that I had to do basicly no programming except for a few lines in methods generated for me, then show off the crappy programs to my parents. Now, I would rather do it myself rather than trying to learn how to work the programs and stuff like that. But I really enjoy using the command line. At least for now!

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

JBuilder does an excellent job. Of all the GUI builders I've used (and I've used (or rather tested) quite a few) it does the best job.
The code it creates is actually human readable, and it does a remarkable job of importing manually written code as well (even if it doesn't conform to its paradigms).

The current versions have automated code formatting options which correct things like indentation and spacing, block editing options to change say the name of a local variable instantly (select the block, edit the name, and all other occurrances in that block change as well), etc.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

I thought the article very good too. The Layouts issue will run and run I'm sure but being fairly new to Java I'm still finding it difficult to code my screen layouts.

Let me set a context for a layout on a screen tab. A large scrolling list, a large scrolling 2 column table and a smaller 6 column table, 6 buttons, a text field and a label. The extact details don't matter but I am thinking of an interactive style screen.

First I was using flow layout, and then box with several panels but I find myself trying to chase and check what needs a preferred size setting etc. Perhaps I use too many panels but I understood that was a good idea to simplify the whole screen into smaller simple layouts. Unfortunately I still get displays with 6 column JTables smaller than two characters!

Recently I've found GridBag more useful although initially I had been put-off it by the advice I mentioned above. Once you get the hang of the weights and column spans it seems to offer a single layer of control.

Any experienced advice on the subject very welcome.

I was using Jbuilder but currently use Eclipse.

Gargol
Light Poster
46 posts since Oct 2005
Reputation Points: 10
Solved Threads: 1
 

Personally I hate GridBagLayout :)

But don't use a single layout manager, experiment with combining them. You can place containers inside containers, using different layout managers for each as required.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

I actually prefer using the GridBagLayout. It is definantly the most powerful layout and if used correctly, can produce great looking layouts. The biggest key with any GUI layout is componitizing the whole thing. E.g.: placing like components on their own JPanel and then taking all the componitized JPanels and placing them on one larger JPanel.

The only other layout manager i use is flow layout and the only time i use it is when creating a popup windows button bar.

Regards,

Nate

hooknc
Posting Whiz in Training
219 posts since Aug 2005
Reputation Points: 11
Solved Threads: 8
 

I actually prefer using the GridBagLayout. It is definantly the most powerful layout and if used correctly, can produce great looking layouts. The biggest key with any GUI layout is componitizing the whole thing. E.g.: placing like components on their own JPanel and then taking all the componitized JPanels and placing them on one larger JPanel.

The only other layout manager i use is flow layout and the only time i use it is when creating a popup windows button bar.

Regards,

Nate


It's very powerful, but the problem is, what if you have 20 components? It takes a billion lines of code with GBL, when you can simply nest layout managers, use arrays, and loop through the initialization.

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 
It's very powerful, but the problem is, what if you have 20 components? It takes a billion lines of code with GBL, when you can simply nest layout managers, use arrays, and loop through the initialization.

Can't argue with that. GUI code has always been really ugly (at least in java) and I've resigned myself to not think about it much.

hooknc
Posting Whiz in Training
219 posts since Aug 2005
Reputation Points: 11
Solved Threads: 8
 

It is really ugly. The GBL is very powerful and has a neat concept to it, but it just doesn't work for my needs.....I wish it did, but it doesn't. If there was an easy way to tie it in with arrays and loops I would love it. Take a calcualtor for example. I would much rather hold ALL the buttons in an array and work from there, rather than coding everything out seperate. It's just too much code involved and it's hard to keep up with.

Normally, my approach is to use JPanels which have their own layout. In the end, I would position the JPanels using setBounds(int, int, int, int); which gives you complete control of the positioning. That saves a lot of time, because the majority of component positioning is taken care of with the jpanels, and all that's left is positioning the few jpanels that you have holding all of that.

Overall I wouldn't mind using the GBL, but it's too much cluter involved.

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

Mmm. That was a good article, jwenting! I especially liked the poem.

This article doesn't refer to Java IDEs, and it isn't specifically about GUI builders, but it is in the same vein:

Does Visual Studio Rot the Mind?

I also use the command line, and emacs is my editor of choice, though I admit that vi has some very nice features.

G-Do
Junior Poster
147 posts since Jun 2005
Reputation Points: 41
Solved Threads: 31
 

I do use JBuilder, but only for prototyping and as an editor.
Love the code completion and class template features, makes coding a lot faster by removing a lot of the boilerplate work.

But, and that's the point, I do know how to do those things by hand and often do when working on other machines (like our Unix servers).
Unless and until you can do that you shouldn't use such tools.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

When you refer to JBuilder is it Foundation?

I am using the standard Eclipse installation. Does it have any support for GUI layout. It seems very scarce. I havn't installed any add-ons.

Gargol
Light Poster
46 posts since Oct 2005
Reputation Points: 10
Solved Threads: 1
 

JB Foundation can do it, but I use JB2005 Developer myself.
Working professionally on web applications I need good JSP, XML, and other editors which the foundation edition doesn't provide.

There are several plugins for building user interfaces for Eclipse but I didn't find the ones I tried much good.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You