Six Swing Lies:

  1. Swing is slow:
    One of my first serious Swing projects started for me about about 1999 / 2001. At that time we had P4 400 MHz machines with 128 MB - 256 MB RAM. We had performance problems with almost everything but not Swing. Of course from time to time someone managed to block the UI-thread, but I wouldn't categorize that as Swing performance issue.
  2. Swing is hard to understand and too complex:
    From my perspective it is straightforward. The UI-components throw many different, fine grained events, but this is needed for more serious applications. I introduced Swing to some non-Java developers and they were able to built amazingly complex Swing apps after a short period of time.
  3. Swing doesn't looks good:
    In general: Swing can look as good, as your designed skills allow. There are no limits. Even better: there are already fantastic, free look and feels out there like: substance, nimbus (comes JDK 1.6.u10) or napkin (:-)). I have a task for you as well: Find a "power" IntelliJ developer. Say to him "IntelliJ looks like crap". Way for reaction but be guarded :-).
  4. Swing doesn't integrate well with the operating system, doesn't looks natively:
    And Eclipse, Office 2007 do? E.g. Eclipse Forms looks good, but not like Vista. There was no requirement I remember so far in my projects so far. Neither in Eclipse RCP, nor in Netbeans RCP projets. I hear this argument a lot at conferences, but not in projects :-). Btw. OS integration was greatly improved in JDK 1.6u10.
  5. JavaFX will swallow Swing:
    Will JPA swallow JDBC, Swing Java 2D or JSF Servlets? Most of the JavaFX widgets are Swing based. In future new widgets will be developed in JavaFX entirely for sure. But this is a good thing. Right now Swing is widely used by big companies.
  6. Swing is EOL / will die because SwingX is no more founded by Sun:
    Swing is part of JDK. Main criticiscm of the "deprecated" mechanism in Java is the actually nothing was removed yet. Event new tools like JConsole or VisualVM shipped with JDK 1.6+  are Swing based. See this post as well. Netbeans is Swing based also (and looks great).
This post was inspired by the the following comment.

Comments:

Hey Adam.

First of all: I prefer deveolping GUIs in Swing instead of using SWT/JFace.

But: Sun failed to offer a decent HOW TO using Swing to build standard GUIs. Me too, I think Swing is way to complicated to implement simple GUIs such as simple data retrieval dialogs and tables showing the retrieval result.

Of course: everything is possible to be implemented using Swing. But it is really hard to figure out how to do it. One has to learn way too much and is next to doomed when trying to develop the layout manually. So you're forced to use Matisse or some similar Swing layout tool which dances with the layout managers for us. Layout managers are a nice idea but really hard to use.

Talking of SwingX: why Swing X? Because the JDK did and still does not provide a mature set of GUI components for implementing standard GUIs. It is a pain to customize sorting and filtering of tables and saving the state of tables, such as order, visibility, widths of columns and of course sort and filter settings.

Sure, that is part of an application framework. Yes and that's the next issue: no standard application framework for standard applications, yet. I like the idea of the Swing App Framework. But it is not ready, yet and I am afraid it will never be - due to the same reason as SwingX development stalled...

I hear Eclipse RCP, NetBeans Platform? Sure. Two awesome and powerful application development platforms. But: those have their drawbacks which make them uninteresting for most developers: it takes some time to get the required expertise to build and deploy (!) non trivial applications including user specific rights and 'Web Startability'. Eclipse RCP has the serious SWT drawback, so there's the NetBeans Platform left and I'd like to see a mature Swing Application Framework, because one usually does not need to have all the bells and whistles of the NetBeans platform.

Performance wise one can build decent looking and behaving applications, but to be honest, I am still stuck with Eclipse JDT because it 'feels better' that NetBeans / IntelliJ - still. I can't explain it, but the dialogs and controls simply look more like the underlying OS. A really bad example - IMHO - is NetBeans unser MacOS X. The toolbars and tabs simply suck. Sure, that's my indiviual opinion and others do love this kind of look.

Summing it up: Swing is a very powerful set of classes allowing an experienced developer to build platform independent GUIs, but what is still lacking is a wrapper taming the flexibility allowing average developers to implement standard GUI applications.

I hope that JavaFX plus a decent app framework will deliver...

Marcus

Posted by Marcus Olk on November 27, 2008 at 12:50 PM CET #

Cite:

Your comment was marked as spam and will not be displayed.

* Comment has more than 1000 characters

Thanks, Adam ...

Posted by Marcus Olk on November 27, 2008 at 12:51 PM CET #

Great post !
Thank you, actually I wanted to explain these things before, but couldn't find all the points in this logical way

Posted by David Hofmann on November 27, 2008 at 02:01 PM CET #

I recently started playing with Groovy and Griffon. That make's Swing even more attractive. Definitely worth checking out. It's a huge productivitiy boost to an already quite productivy framework - I always was faster with Swing than with SWT.

Posted by Claus Hausberger on November 27, 2008 at 04:00 PM CET #

When it comes to event-driven widget synchronization Swing sucks as badly as all the other GUI frameworks. I tried for two weeks to align the scroll position of two JTextPanes, then gave up.

Don't tell me about Bruce Eckel's method, it does not work anymore when you start changing the text content/styles of your window.

I finally migrated to SWT, had to fiddle around for another week, but it finally worked.

There should be a TDD'ed GUI toolkit - not an easy job, but that would finally give us an API that is useable.

Posted by Bob Lauer on November 27, 2008 at 04:33 PM CET #

As long as there is no alternative to Eclipse GMF, I am forced to use SWT/JFace. No matter how Swing has been improved.

Posted by Thomas W. on November 28, 2008 at 12:44 AM CET #

well say!, I will like to add, maybe predict?, in the future when an application framework is build and recommended, people will start complaining about how the framework is limiting their possibilities for writing great Java desktop apps.

Posted by davidecr on November 28, 2008 at 04:29 AM CET #

Hi Thomas W,

there is a great alternative to GMF - http://graph.netbeans.org/.

The only problem is: there is no alternative to EMF. So if you "just" have to visualize graphs, there are much better frameworks than GMF. But if you have to visualize models / metamodels, then Eclipse EMF / GMF "bundle" is the right choice,

thanks for your comment,

adam

Posted by Adam Bien on November 28, 2008 at 09:48 AM CET #

Since I started working with Flex I began to hate the Swing layout managers even more. Flex has simple containers like HBox, VBox or Grid. In combination with relative sizes of the components (e.g. height="100%") it's very easy and intuitive to create complex UIs, where on Swing I would had to use GridBagLayout or a graphical GUI builder.

Posted by CarstenSchlipf on November 28, 2008 at 11:57 AM CET #

@Carsten,

you mean the GridBagLayout from 1945? :-).

Just try out GroupLaout - with Matisse. This combination rocks!,

regards,

adam

Posted by Adam Bien on November 28, 2008 at 02:53 PM CET #

Thanks for the tip, Adam !

But I mean graphical editors which are based on solid foundations, that is models.

I would be happy to see some competition from Netbeans in this field.

Unfortunately, Netbeans MDR is far behind Eclipse EMF.

Posted by Thomas W. on November 28, 2008 at 11:43 PM CET #

Thomas,

MDR is not only far behind, but isn't very active as well - the project was just initiated too early.

Speaking about solid foundations: if you would like to visualize your domain objects (like JPA), the http://graph.netbeans.org/ is lot easier to use. It can be even developed without generating :-),

regards,

adam

Posted by Adam Bien on November 29, 2008 at 10:13 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
...the last 150 posts
...the last 10 comments
License