tags:

views:

299

answers:

5

Till now, I had been using Netbeans Swing GUI generation feature to build GUI for my java applications.

Now I have started using Eclipse for my projects and have dropped Netbeans. So apart from coding manually all the code for GUI, what are the other ways with which I can build GUI quickly and in a much better way.

+2  A: 

You can keep coding it manually but using GroovyBuilders (link) that are enough faster than using plain java but you will need to embed Groovy lib inside your application..

otherwise there exists a layout manager, called MIG Layout, that works quite well (it's much more practical that normal gui building)..

I also used a tool called JVider to build some simple applications, but using a visual approach you get always the same nasty thing: keeping interface and backend synchronized, considering also the "bindings" between visual objects and variables name..

Jack
A: 

The experience I've made is that Netbeans is pretty much as good as it gets for building Swing GUIs if you want to be able to just click your application together. Just like you however, I enjoy coding in eclipse a lot more than in Netbeans (personal preference, Netbeans is still great editor imo). For a while I ended up creating my GUIs in Netbeans and then just importing the projects into eclipse.

This works alright, but in the end I think you'll come to the same conclusion I did, that it's just best to learn the layout managers and code the GUI by hand. Maybe take a look at the ones provided by JGoodies as well if the ones provided by Sun just don't do it for you.

Herminator
+1  A: 

I ran into a similar situation, but discovered that NetBeans actually has a nifty 'import eclipse project' functionality. So, I ended up doing the visual GUI design work in NetBeans, but used Eclipse for coding, debugging and profiling. Netbeans adds some files to your project, and you may want to tweak the auto-code generation templates in NetBeans, but this is a solution that works for me. Of course, Eclipse also ships with its own visual GUI builder, but I prefer NetBeans for visual GUI design and development.

Importing Eclipse projects in NetBeans.

The Eclipse Visual Editor project

Luhar
A: 

Another approach is to use some XML library, like SwixML. To work with it requires some code changes but separates your UI from your code quite well. On the other hand, it is only a wrapper around the swing classes. This is IMHO both an advantage and a disadvantage. It is also a quite nice library for rapid prototyping, because you can (usually) try a dialog out until it is sufficient.

Frank Meißner
A: 

The Eclipse Visual Editor project mentioned by Luhar is quite nice, it can use any bean style swing or awt component and supports editing already existing classes since it relies on reflection instead of separate meta-data.
Also there are no limitiations as how you can manipulate the generated code as VEP will do its best to keep it when modifying the source file.
I would recommend a rather highend system if you want to use it for more complex components as it is quite resource hungry.
Nice things about VEP:

  • Supports Swing/AWT/SWT
  • Uses the source-code and reflection no additional data required
  • Can be used with already existing components (see above)
  • Can edit code directly or in preview window
  • Generates clean looking code without breaking existing code

Not so nice things:

  • Slow, don't forget to pause the preview function when editing source code directly, it will try to refresh almost constantly.
  • Don't use the Preview window while you have compilation errors in your code, any changes made to the preview may cause a messed up edit in the source. You have to clean up any compilation errors before using it again.
josefx