Jun 26

Java GUI frameworks

Category: Uncategorized

One of my duties as an undergraduate research student, is to build a Java front end for one of the tools my professor has.

I checked out a few of the choices available for a Java GUI, and I eventually settled on Swing.

People seem to either love or hate it, and I’m curious why.

I picked swing as it was the most familiar, logic-wise to me. I’ve been polluted by Tkinter, sorry. But Swing makes sense to me. LayoutManagers, Buttons, Panels, Containers, Components… it makes sense.

The only difference I see between Tkinter and Swing, is that Tkinter uses callbacks, and Swing uses Listeners. But even Listeners make sense, as it is after all an event-based architecture. I can do implement a Listener any way I want, in any customized component, or even separate classes.

Swing gives me flexibility without imposing massive layers of abstraction on me(unlike a few other culprits I’ve seen… *whistles*).

But I want to know what you like, or dislike about Swing, or any of the other Java GUIs.

4 comments

4 Comments so far

  1. donnie June 27th, 2008 4:26 am

    http://en.wikipedia.org/wiki/Standard_Widget_Toolkit

    I like SWT, because it accesses the native GUI libraries. That way, it has a native look/feel on all platforms you run the software on, instead of Swing’s or AWT’s weird looking widgets on ALL platforms. Some of the well known programs that use SWT are Eclipse and Azureus.

  2. Aziz June 27th, 2008 4:50 am

    I’ve grown up with Swing. Once you understand that any layout can be made with a combination of box and flow layouts in a top-level border layout, and it works for most applications (especially with toolbars), you’ll not be struggling with layout issues as much. The Swing library is very rich, and although sometimes it’s complex, if you take it one-at-a-time, it’s a lot mroe simpler. Usually most of the default models are fine, and there’s usually also premade ones to fit your needs. Customizing can seem a bit tedious at first – but if you look at it apart from the larger picture, it boils down.

    The fact that Swing’s got amazing javadocs and even a great online tutorial (http://java.sun.com/docs/books/tutorial/uiswing/) makes it better, as there’s mention of just about anything in the tutorials, and mention of exactly everything in the docs.

    There are some things about Swing that bug me though. To name a few, it’s FileDialog severly lacks functionality, and it’s tough to make a custom dialog that uses platform alike icons (for example, a custom error dialog).

    I haven’t heard of Tkinter, but then there’s SWT. If you’ve used Eclipse, you’ve seen SWT. It’s a different approach to Swing, and at times they were seen as enemies, but know they’re like a Sonic-and-Knuckles kind of thing. (All this I’ve read, not experienced :P ). From my experience, SWT’s pretty easy to pick up and there’s some great tutorials out there as well.

  3. admin June 27th, 2008 7:29 am

    Thanks guys. Tkinter is the default GUI toolkit for Python, automatically available wherever the full installation of Python is. However, I do prefer wxPython(based off of wxWindows) as it is a much more powerful gui framework for python.

  4. rizzix June 28th, 2008 10:54 am

    Swing is great, but there are alternatives. SWT was mentioned. However, there’s also the relatively new Qt Jambi: http://trolltech.com/products/qt/features/language-support/java

    Unfortunately, the free (open source) version can only be used for opensourced projects.