tags:

views:

2019

answers:

22

What mechanism do you prefer for building a GUI: from scratch or using GUI-building software?

+1  A: 

Depends on your requirements. Some GUI building software work really well with simple applications, however, if your client requires many custom components the third party GUI builders may not work.

Also, it depends on the amount of forms and the complexity of them. If you need to build a form for each table in the database, for example, a third party GUI builder may be faster and cheaper.

In my experience, it really varies from project to project.

northpole
+2  A: 

Both - use a WYSIWYG editor to get the ball rolling, but at the end of the day you'll need to manipulate your controls and in some cases create them programmatically at run time. Eclipse has a variety of free editors as plugins. Go to eclipse.org and look through the plugins listing.

sweeney
A: 

If you want a complex gui, then use something like netbeans to build it and create all of the events. If you're looking for a fairly simplistic gui, then building one by hand is still an option.

Robbie
I disagree; it's possible to build very complex GUIs by hand.
Joe Attardi
I'd say exactly the opposite, complex GUI's usually have dynamic controls that are added or changed at runtime, and you cannot do that with a RAD designer.
fortran
Ok. Both of you are right, but for your own reasons. That doesn't mean I'm wrong either, the original question was an opinion, and this is mine. My opinion doesn't deserve a -1 just because you disagree. Just saying...
Robbie
+1  A: 

My company uses Netbeans for GUIs and eclipse for the regular programming.
We have looked but we haven't found any other (free or at least cheap) tool that does GUIs as good as NetBeans.

I used to write them from scratch with a plain text editor...

Stroboskop
Why not use netbeans for both?
SourceRebels
Because NetBeans is annoyingly slow, buggy and completely messes up your code when you try to use some of the more fancy features. If you're programming for a living you don't want to tiptoe around all the pitfalls that will cost you two hours just to get things running again.
Stroboskop
A: 

It really does depend on what you are trying to accomplish with the GUI. When I was tossing together ideas for a Computer Science class and testing functionality, the Netbeans WYSIWYG editor was great since it automatically generates a lot of the code for you. However, I found you tend to get better control with doing it by hand (in Java) than learning Netbeans.

+2  A: 

You need to know how Swing works to be able to make things work properly. Nothing like building by hand to learn that :)

THEN the Netbeans GUI builder is rather nice.

Edit: I would strongly recommend going through the Java Tutorial Swing Trail - http://java.sun.com/docs/books/tutorial/ui/index.html

Thorbjørn Ravn Andersen
A: 

I tried to use Eclipse's Visual Swing plugin, but on some occasions, the code it generated just disappeared, and I was left with a screen full of errors. In all the GUI apps I write, I use Netbeans, even though I hate the code generated when using GroupLayout. However, if layout code is not your concern, I think you'll be very pleased with the development speed it offers you. The only thing you'll have to do is implement the event logic and other logic you may require.

Geo
+2  A: 

Look at Visual Editor for for Eclipse

You will still want to understand what the editor is doing for you.

Maestro1024
I've used it, it's alright. He's right tho, after a while you'll find yourself getting fed up with auto-generated code and just fixing stuff by hand.
sweeney
+1  A: 

That depends what the reasons you're making the UI for,
I found that there are two reasons to make UI:

First is for clients, in these cases you want to UI to be polished and to handle really well in projects like this the core or essence of the project is the UI itself.
In these cases it's usually the best to hand-craft the code for your UI because it's probably non-trivial code.

Second reason is usually quick & dirty UI where the core of the program is something else and the UI is created usually for Control aspects on your main application and you are the main client.
In these cases the best thing to do is make the UI as quickly as possible as you don't want to "waste" time working on it and its more legitimate to use WYSIWYG editors.

Yon
+1  A: 

I always find a GUI builder to be a good idea to begin with and then I end up in a situation where I am wasting my time fixing things to my own ways rather than that of the IDE and making them actually suit. And don't get me started on the messy code that GUI builders generate! Hence, it's often more efficient to build from scratch; at least for me...

Smalltown2000
+2  A: 

If you give me the choice between NetBeans and by-Hand I'd definitely choose by-Hand. I was never really convinced by the NetBeans GUI builder's approach. At least the last time I used it, it relied on some proprietary sidecar files...

zedoo
+11  A: 

If the question is about GUI development using Swing then IMO it is best to code everything manually without a WYSIWIG tool.

In order for a manual UI design/coding to be efficient a really good layout manager should be used. MigLayout is one of such layout managers. Since I've started using it I have never looked back at WYSIWIG tools -- a sheet of paper, a pencil, MigLayout and you get a full control over your design and code.

Also tools like Balsamiq simplify making GUI mock ups for quick prototyping if the paper and pencil approach is not suitable.

01es
+1 - I do *tons* of GUI work, and I can tell you that the effort I put into manually laying out a GUI using MigLayout is so small compared to the other GUI related work that it isn't even worth measuring. The hard part is wiring up controls, binding to models, dealing with actions. That's the stuff that takes time. Every time I've used a GUI builder, I've regretted it.
Kevin Day
Exactly -- MigLayout saves tons of time, which is indeed needed to deal with UI controls.On the subject of binding, our team had to actually roll out our own binding framework based on JGoodies Binding in conjunction with a set number of UI controls that cover 99% of our GUI needs. The instantiation of UI controls happens automatically based on the type information for class properties that need to be bound. This approach saves quite a bit of time.
01es
+2  A: 

I use GUI builders to rapidly prototype designs and stuff like that. But when it comes down to building the actual production GUI, I code it from scratch. I'm not morally opposed to GUI builders, but I prefer the greater control over my code I get from writing it by hand.

Like any code generator tool, IMHO, you shouldn't use a GUI builder until you at least understand the concept - in this case, the Swing layout managers are particularly tricky.

Joe Attardi
ryansstack
A: 

Eclipse's Visual Editor is a great choice, because the code that it generates is very straightforward and there's no hidden magic. Plus, you can make changes by hand and the editor will reflect them.

fortran
+1  A: 

I prefer hand coding the GUI myself so I can have complete control. For complex layouts I will use JGoodies Form Layout. Their syntax for specifying the layout makes it easy to draw the GUI on paper then transfer this to code.

I tried the Netbeans GUI builder and was impressed by how easy it was to use. Then I looked at the code it generated using GroupLayout and decided that by going that way you were basically locking yourself into Netbeans which was something I did not want to do.

Mark
+1  A: 

I started by coding it manually using Swing. Now I use WYSIWYG editors, but I think it's important to know what's behind the editor. Also you might need to update the code manually, WYSIWYG editors often can't do exactly what you want.

marcgg
+6  A: 

My personal opinion is never use visual editors. Until there is a single standard for GUI-building in Java you will find yourself tied to an IDE. The best IDE for building Java GUI has switched around quite a bit in the last 10 years (I wonder how many projects were hit by a massive maintenance overhead from switching away from JBuilder for example).

For most applications, the actual layout of GUI code is probably something like 5-10% of the total amount of time you are likely to spend writing the app as a whole. Therefore even halving this by using a designer is not really saving you very much in the grand scheme of things.

Taking this together with the lack of flexibility and more complicated maintenance, it's almost always better just to write the GUI by hand.

oxbow_lakes
amen (and yes, I felt that JBuilder pain)
Kevin Day
You really able to deploy a fully functional GUI application to a happy client on time, without ever using a GUI editor? Surprising! I take my hat off
Yan Cheng CHEOK
If by "happy client", you mean the guy a few seats away who uses my apps, then yes. At least I think he's happy, it's been a while since he threw anything at me
oxbow_lakes
A: 

I test-drive the model of the UI, so that I have the functionality of the UI enclosed in a class that is completely decoupled from the GUI library and can be easily tested in isolation. Then I create a thin wrapper layer on top of the model, so that the GUI's event handlers are mostly one-liners that delegate to the UI model.

I've been using mostly IntelliJ IDEA's GUI builder (using the JGoodies Forms layout manager). It has been quite handly for laying out components in a static layout. But I think that for example with MiGLayout it's quite easy to write the GUI layout code by hand, so a GUI builder is not necessarily needed, and it helps to avoid tool lock-in. And dynamic layouts will anyways need to be written by hand.

But before writing any code, I first design and test a paper prototype of the UI, so as to have a clear vision of what needs to be done.

Esko Luontola
A: 

If you aim to create the final Java GUI, I recommand the Eclipse plugin named "Jigloo GUI Builder", which can generate clean and maintainable Java code. If you just want to create the GUI quickly for review, you can try the UI prototyping tool like "ForeUI".

Rose
A: 

There's nothing wrong with using a GUI Designer when : You understand what the IDE does and what it generates, how to customize the IDE output You understand the code actually generated by IDE

Understanding at least the basics of Swing is important. Imagine the following scenario which happens just too often.

Q:"I have 10 years of experience writing swing applications"

A:ok

Q:How would you debug this code

A:Oh wait, there's no Netbeans form file??? You guys are not high tech!

Q:Hum.. you don't understand it?

A:Of course not, it's like machine code, you need to refractor it all and use an IDE!
+8  A: 

I actually enjoy building GUIs with the NetBeans GUI Builder; the thing is, it is fairly customizable - it allows you to change the code used for auto-generation and the auto-generated code [no pun intended] (which is necessary for custom components), it also allows "easy" event-handling and binding. And NetBeans GUI Builder is not restricted to GroupLayout but rather allows you to choose which LayoutManager to use (a somewhat hidden setting in the form's properties dialog).

But it is not always the best choice; as others already said: MiG Layout is a good choice when you need to have full control of your application, knowing every single JLabel, every JButton etc.

I must confess I prefer Netbeans' GUI builder for the ease of use and WYSIWYG view. But I also think that it does not even matter if you have created the GUI-Code by hand or with a GUI-Designer; adding Controls / custom Components dynamically works with both, doing this and that works with both etc.. The only thing that matters is that it works.

(From my point of view I do not see a point in coding a GUI manually if it can be done faster with a GUI-Builder, as I do not see why one should bother coding it by hand without some kind of benefit)

Tedil
A: 

Having created Java GUI's extensively, I can assure you the process is quite often painful. I'm well aware that Java's strength does not lie in it's GUI, but I'm surprised that a decent free interface builder tool hasn't been released.

Sometimes I'll use Eclipse's Visual Builder tool for quick and dirty mock-ups. It's code generation is a bit scary IMHO. I believe Netbean's Visual Editor is the best available at the moment (for free anyway); however, I find myself hand rolling GUI code for consistent cross-platform layouts. If your disapointed with these free GUI editors (like me), quite honestly, just use a layout library (like MIG) and just do it yourself. It'll be slow at first, but you'll have a lot more control and less editor newonses.

Rev316