views:

326

answers:

6
+1  Q: 

Swing Generator

Hi, I need to develop some java gui using swing.
A few years ago I did develop a bit with swing.
But it was pretty exhausting, you see, back than there weren't much tools to help you.

But I do believe today it should be easier, there must be tools.
I would like to use some kind of a generator or maybe a utility or even a framework.
I know Eclipse has a few plugins and Netbeans has a nice built in tool. I have also heard good things about Jide framework.

But still, I don't really know any of them.

Is there a tool/Utility/Generator/Framework that you have used and really helped you?

Obviously I would prefer something that is free, but if you know something that is really really good and cost money, that could work too.

Thank you.

+2  A: 

For quite a few years I've used NetBeans built in "Matisse" form editor. It's got the advantage of being built into the IDE, so that the form editing and code generation is rather seamless. If you're new to Swing it can be a big boost (as long as you continue to use NetBeans as your IDE).

There are some issues, however:

  1. You can't easily move a form to another IDE. The generated code may work, but the form data itself is stored an XML file.
  2. If two more people edit a form at the same time, conflicts can arise in SVN/CVS that are nearly impossible to reconcile. The XML is not really human readable.
  3. In the past I found the form XML file to corrupt itself, which would lead to form generation errors.
  4. The form editor can get a mind of its own sometimes, destroying your arrangement when you do something as simple as resize a control.

In spite of all the above, I've continued to use it as nothing else has seemed appealing to me.

Jason Nichols
Yeah, Matisse is a quick way to get the job done.
Geo
Matisse has only one "t".
Martijn Courteaux
+2  A: 

Actually the faster way to write Swing frames that I've found so far is to use Groovy SwingBuilder but you have to include groovy's jar inside your project to use it. This is an example taken from their website, it's mainly synctactic sugar but it helps:

def frame = swing.frame(title:'Frame', defaultCloseOperation:JFrame.EXIT_ON_CLOSE, pack:true, show:true) {
    vbox {
        textlabel = label("Click the button!")
        button(
            text:'Click Me',
            actionPerformed: {
                count++
                textlabel.text = "Clicked ${count} time(s)."
                println "Clicked!"
            }
        )
        widget(sharedPanel())
        widget(sharedPanel())
   }
}

Otherwise there are some "visual" approach to the problem but they don't let you integrate so quickly with the interface you wrote (for example jvider), NetBeans and Eclipse have some plugins to do the dirty work but as before: you can't integrate so seamlessy.

Jack
A: 

In terms of GUI Builders, NetBeans and IDEA (now going open source with the 9.0 Beta) both have free GUI Builders.

GUI Builders have all the kinds of downsides that Jason spoke to. If you want good control over what is going on, but still want something sane to write a complex GUI by hand, check out MigLayout.

Yishai
A: 

Eclipse's Visual Swing is a promising upstart. It isn't the most stable thing in the world, but it does all the form stuff in code, so there are no separate files which are hard to read and merge in source control. When you first try it, it takes some getting used to. But once you learn to work around the bugs you pretty rapidly develop Swing GUIs.

tster
A: 

I would go w/ matisse if you wnat to use a gui builder, and there are shortcomings as Jason mentioned, but you also need to include a jar file that is used by the matisse layouts, this may or may not be a problem.

But if you are going to be developming UI's in swing, you will soon come to find out most of the gui builders have many shortcomings, and when you have to change something the generated code is not always clear and is bloated. You will also find that once you become proficient you can write a ui much faster by hand than the gui builder, and you will really understand what is going on.

So I say stay away from gui builders, you will create better and more maintainable UI's, and w/ some time and experience will not want to use a gui builder. Just start w/ some of the basic Swing tutorials on layout.

broschb
A: 

May I humbly suggest Metawidget?

It takes a different approach to UI development - removing much of the error-prone, tedious work whilst still retaining the flexibility of traditional toolkits. It integrates with your existing front-end (Swing, in your case) and back-end (Java, I'm guessing), and works at runtime (no code generation).

There's a few short intro videos here:

http://metawidget.org/videos.html

If you get chance to take a look, I'd be most grateful for your feedback.

Regards,

Richard.

Richard Kennard