Java Notes

GUI Alternatives

The problems

After a little experience, it isn't difficult to build a Graphical User Interface (GUI) in Java, but it is hard to get something that is easy to write and maintain, and looks good. Many styles of GUI programming simply don't scale well.

Separation of concerns

Some GUI programming alternatives

Some of the main alternatives to simple programming that are getting the most attention are:

Disucssion of implementing a GUI in code vs XML is at Resource based GUIs vs. Code Generation.

F3 is a programming language that generates Java Byte Code, and has an interesting approach to generating a GUI. The F3 Programming Language is probably not the best link to it, but it's so early that there doesn't seem to be much mature documentation on it. An interesting idea anyway.

More alternatives

  1. Use Drag and Drop GUI editors. Many IDEs (NetBeans, Eclipse (only SWT), JBuilder, ...) have GUI editors and there are also numerous standalone products. They don't always enforce separation of interface and logic, but it's usually easy to do. I've used NetBeans with good results.

    The new NetBeans Matisse project looks promising.

  2. Alternatives to Swing and AWT. You don't have to use the Java GUI libraries to build your GUI. There are alternatives.
    • SWT - IBM's alternative to Swing. An interesting discussion can be found at www.hacknot.info/hacknot/action/showEntry?eid=74.
    • Buoy - (buoy.sourceforge.net/) - "Buoy is a library for creating user interfaces in Java programs. It is built on top of Swing, but provides completely new classes to represent UI components. Its advantages include a simpler API, a more powerful event handling mechanism, and much more."

      Public domain. Looks interesting. It's educational to read the About Buoy document, which points out a number of problems and inconsistencies in Swing.

      BuoyBuilder (/www.buoybuilder.com) can be used to build Buoy applications. It's free for non-commercial projects.

  3. Use Flash or JavaScript+HTML for the GUI. Why should your interface be in Java? You can use existing GUI technologies like Flash or JavaScript+HTML (check out Sun's LiveConnect, which should already be installed with your version of Java) to interact with your Java program. Apparently this sounds better in principle that in practice. I'm not away of many users of this approach.
  4. Describe the GUI in some other language (eg, XML). This approach is described below in the XUL (XML User interface Language) philosophy.

The XUL philosophy

Everyone says that user interfaces should be separated from the logic of a program. One of the most promising approaches is to represent the GUI in a markup language (think HTML forms with a full set of widgets). The Mozilla XUL group (see link below) has been one of the most active in proposals in this area, altho their actual offerings don't seem quite ready for prime time. Some good links to start with follow.

I've tried SwixML and Thinlet, both of which read an XML file to build the GUI at execution time. On small test programs I really liked them. They're not quite mature yet (eg, weak documentation). SwixML has a number of users and a helpful mailing list.

Take a look at XUL and Java. It seems obvious to me for some comments by Karsten Lentzsch of JGoodies for some criteria that might be used in evaluating this not-entirely-obvious technology.

Microsoft announced XAML, an XML description of user interfaces (and much more) for the upcoming Avalon system (see below). It looks like Microsoft may take the lead in this area; and I wouldn't be surprised if their work sets the future direction. Java's Java Desktop Network Components (JNDC) (see www.javadesktop.org/articles/JDNC/index.html, Java Desktop Network Components) shows some philosophical interest in XUL.

XUL based and other GUI generator schemes

I didn't look closely at most of these, but this gives the idea that a lot of people would like to make this work. My goal is to find something that makes simple programs simpler, ie something for student programs. Some of these frameworks may be very good for simplifying large programs, but don't seem simpler for small programs.

SwixML www.swixml.org - I've tried SwixML with mixed feelings. On one hand, it forced a very nice separation of presentation from other concerns, and it worked well. One the other hand, there was a lack of documentation and error reporting that made development very time-consuming. If you put in the time to become an expert, this may be a rewarding approach. Open source.
Thinlet www.thinlet.com - Open source. The author's philosophy is aim it at handheld devices. This is worth a look if you're interested in something small, and not based on Swing. I liked the previous version, but haven't looked at the new version.
SwingMLswingml.sourceforge.net - Open source. Looks good, but it isn't obvious how to connect the GUI to a Java application. Seems to be oriented toward Applet server communication. Nice demo. Last update Aug 2003.
CUFcuf.sourceforge.net/ - CUF (Client Utilities and Framework) provides an XML representation of the GUI that will work with either Swing or .NET. Interesting, but where's the documentation? Open-source.
AUIML www.alphaworks.ibm.com/tech/auiml (Abstract User Interface Markup Language Toolkit). Includes an interface builder, and same interface can be used either as Swing or HMTL servlet. Works with the Eclipse Visual Editor.
RIB www.alphaworks.ibm.com/tech/rib - Reflexive User Interface Builder -- Another IBM approach using XML to represent a Swing / SWT user interface.
xmlgui xmlgui.tigris.org - Interesting, but little documentation. Has editor. Defines additional useful widgets. Has been used in real project so probably works ok. Not appropriate for simplifying student programs. Open source.
SpeedGJ www.wsoftware.de/SpeedJG - I'm looking for free student tools. Might be good, but at $70 I'm not going to check it out.
xWidglets xwidglets.secretgate.com - GUI editor produces XML UI representation. Free download includes editor, gui engine, documentation. The web site is in French, but at least some of the screenshots show English menus. It's not clear how this is used as an interface to a Java application (my interest), but an example is given using JavaScript. I haven't tried it.
FormBuilderThe SwingEmpire FormBuilder GUI editor builds on the excellent JGoodies layouts, but it doesn't seem mature yet. Last updated 2004?
Java-XML-GuiBuildersourceforge.net/projects/jxmlguibuilder/ - GUI builder from XML. Open soure. Last update 2003.
XUI [1] xui.sourceforge.net - Open source. Seems to be actively worked on. Doesn't appear to make small programs simpler. This is not the same as the XUI project listed below.
XMLTalk sourceforge.net/projects/xmltalk - Target is handhelds. Open source.
KoalaGML koalagml.sourceforge.net - Open source. Inactive?
Ultrid www.ultrid.com - There is active development on this project. My first look at it had left a lot of Java details unexplained, but there's a lot more there now. Supports many layouts including table layout, splash screens, wizards, localization, and much more. Also strong support for various scripting languages. Worth a look. It appears to be free (beta 0.7.5), but without source.

There are related efforts, such as

Spring Rich ClientSee Spring Rich Client
XAML Microsoft's new XAML technology can be used to specify GUI (and much more) design in XML, and the tags directly map into C# classes and other MS languages. Take a look at this MSDN article - msdn.microsoft.com/msdnmag/issues/04/01/Avalon.
XUL www.xulplanet.com/ - XUL is a spinoff of the Mozilla browser user interface project that has inspired many similar projects. This is somewhat of an umbrella organization for XML interfaces.
XFormswww.w3.org/TR/xforms may define sufficiently enhanced XML forms that can be used for program interfaces, but ...
BML Bean Markup Language www.alphaworks.ibm.com/tech/bml/
JEasy www.jeasy.de - $49
JBeaverwww.ratundtat.com - No longer available?
text2guiwww.tacosoftware.com/products/text2gui Uses resource bundles to store the GUI description in text. Can easily internationalize. Looks interesting. Not free.

GUI Editors

jviderwww.jvider.com - $69. Last update 2004?
JFormDesignerwww.jformdesigner.com - 129 Euros. Has some very nice features.
JGB Java GUI Builder jgb.sourceforge.net - Open source. Inactive?
Eclipse/VEP www.eclipse.org/vep/WebContent/main.php - Eclipse Visual Editor Project plugin
Jigloo www.cloudgarden.com/jigloo - SWT/Swing GUI Builder for Eclipse and WebSphere - Free for non-commercial use
FormLayoutMakersourceforge.net/projects/formlayoutmaker/ - WYSIWYG tool that enables you to easily build Java Swing layouts using the JGoodies FormLayout layout manager. Open source.
Abeille abeille.dev.java.net/ - "Abeille Forms Designer is a GUI builder for Java applications. Developers and designers can create complex, professional forms in minutes. Designers can drag and drop components onto a WYSIWYG editor. Full support for undo/redo and copy/paste is provided. Components can be easily customized by adding images or modifying their properties. Advanced fill effects are supported such as textures and gradients."
Java Object Facesourceforge.net/projects/jof/ - "JOF provide a way for displaying and populating java objects. JOF automate the creation of GUI forms and it’s able to produce AWT/Swing/JSP interfaces, just by passing java bean or XML to it.JOF is an Object-to-GUI solution!"
Atris sourceforge.net/projects/atrisframework - Open source.
Foam www.computersinmotion.com $150, 15-day free trial, but it's free to students and educators. Uses it's own layout manager. Take a look at the video. Separates the interface from "model". Apparently cross platform. Looks interesting, but website doesn't have much documentation.
Qt Designerwww.trolltech.com/products/qt/designer.html can produce a .ui file that can be run thru UICompiler (uic.sourceforge.net). I've tried this combination, and was unable to get it working without errors, perhaps because on Windows the only free version of Qt Designer (2.3) is old and didn't play well with UICompiler.
RADi www.muntjak.de/hans/java/radi/index.html - Free for non-commercial use.

RADi is an easy-to-use, though powerful, Java GUI builder and JavaBeansTM container. It is intuitive to use, supports drag and drop and you don't have to care about layout managers. Though you can create layouts of any complexity, RADi provides tools to master this complexity. RADi comes with a royalty-free runtime library which processes your layout definition files, creates the GUI and executes listeners, event and property handlers.

Alternatives to Swing

Altho Swing (or the older AWT) is the standard for a Java GUI, there are alternatives. These alternatives exist because some are smaller and/or faster than the very general, but large and somewhat sluggish Swing library.

SWTStandard Widget Toolkit, www.eclipse.org. This free GUI library from IBM provides an interface to the native system GUI (currently Windows and GNOME). The advantages are a more responsive user experience, and the Eclipse GUI editor for uses SWT, not Swing. The disadvantages are a different API so your programs can't simply be changed from Swing to SWT, and it isn't as portable, at least until versions are available for more systems. It's possible to compile completely native (no virtual machine!) programs for Linux.
SwingWTswingwt.sourceforge.net. This free GUI implementation provides a Swing compatible API, but uses SWT for the implementation. Because it's compatible with Swing, it's easy to try this out.
BambooKitwww.bambookit.com. Light-weight XML-based GUI good for small devices.
Zavalwww.zaval.org. Another light-weight GUI.

See also