Interview Day: HTML / CSS Finally, it is time to be an adult
Feb 20

Swing is drowning

Java, Tech with tags: , Add comments

Drowning

Sun needs to do something drastic else Swing will drown. Although many people tease about the complexity of Swing, it does do a lot of things right.

Unfortunately the ship has not turned fast enough to reach its potential, and it is losing the race fast to the Web, Air, and WinForms.

Sun seemed to put its might into JavaFX and left Swing itself with a skeleton crew that I feel sorry for. A lot of the top Swing folk have actually left. Some for Google, and some for Adobe.

How many people do you think are working on the Swing core? I bet you would be shocked. I think that more people live at Ben’s house :)

How many young developers do you hear jumping into Swing development? The “cool” factor isn’t there. It is all about the Web and Air. The Air development team is growing fast.

Who can save Swing? Sun needs to put its hands in its wallet, but it doesn’t appear to be doing anything other than hoping that JavaFX can compete. Ouch.

Update: I got a lot of emails and comments on this, so I have written up more thoughts on my reasoning.

22 Responses to “Swing is drowning”

  1. djo.mos Says:

    Hi,
    Actually, IMHO, Swing is a bit over-bloated, and a total remaking-of is a possible solution. I mean providing a totally new and clean and modern API, in order not to break the ascendant compatibility.

  2. Christian Cantrell Says:

    Maybe I’m too entrenched in the web world, but I thought Swing already drowned a long time ago. I can’t think of what I would possible use Swing for. What do people build with Swing? Probably a lot of internal tools, which is all I’ve ever done with it.

    I’m not passing judgement by this comment. I love Java. I dedicated 4 years of my life to writing Java on the server. I’m just not sure Swing ever really found it’s place on the desktop.

    Christian

  3. Howard M. Lewis Ship Says:

    Swing is too complex and throws all that complexity in your face. Worse, it is not thread safe, and yet you *must* use multiple threads in order to create a responsive interface. It seems like there’s only ever been a tiny pool of people with the experience to write a good Swing UI.

    I remember working with Ben Galbratih on a simple UI and all I wanted was the option to click ‘c’ to continue and I just couldn’t get it to work. Ben looks it over and spits out a big chunk of completely unintuitive code that would have taken me a week to locate. Maybe if I had stayed I would have eventually hit my groove, but I’m not so sure.

  4. JBL Says:

    I think that Swing is a verbose and some features like bindings are coming a bit late. But a part of the complexity is linked to the possibilities provided. After having the new projects in this area : Beans Binding, Swing Application Framework and Scene Graph, Substance LnF i was again interested in giving it a try.

    In regards to Java FX this’ll be usefull but i think they missed one of the points of MXML/Flex : a very compact language that you can hand code. JavaFX is too verbose to be used without tooling.

    But the your post is linked to insider informations, sad if it’s true but it seems to be some smart people in the Scene Graph project for example.

  5. Jonathan Giles Says:

    I personally spend basically all day every day coding in Swing and Java2D. By no means is it drowning or anywhere near dead. Perhaps it’s because I have little experience in GUI frameworks outside of Swing, but I find it incredibly intuitive and powerful. The application I develop is called Centruflow, and is completely written in Java using Swing. You can see more about it at http://www.centruflow.com.

  6. Jonathan Giles Says:

    With respect to the above comment, ignore the period in http://www.centruflow.com

  7. Chris F Ravenscroft Says:

    Christian:
    I manage a big project written in Swing. It’s a network management tool and I guess that’s my answer to your question :)

    Howard Ship:
    What do you mean, not thread safe? As long as you remember to delegate your updates to the event thread, you’re pretty safe and UI responsiveness is here. As JBL points out, complexity stems from Java’s power.

  8. afsina Says:

    We have a major project with swing replacing a legacy system. Because it is very flexible, it allowed us to make weird-difficult customer required customizations. it would be difficult to do in other graphics toolkits and simply impossible to do it in Web. Also Webstart, although not perfect gave us a nice deployment environment. So, i think people should drop the java-swing bashing before actually using it in a real life project with a lot of custom requirements.

  9. Jin Chun Says:

    Swing is still alive, but you are right. They need to dedicate more to Swing in general. JavaFX seems nice, but its going to take a lot to push it back into the frontal lobe of relevant development. As for the others, Web N.X will always be around, but Flex/AIR? You’ve got to be kidding right? An installer with a crappy native API with KWeb embedded? I’ve deployed Flex in production and will be ripping it out. Flash/Flex is fine for ESPN and Disney, but in the enterprise, hopping firewalls, reverse/forward proxies, large datasets, etc., it’s still a toy, and wayyyy too immature.

    If anything, with the large 3rd party community around .Net and WPF ramping up, Silverlight 2.0 or whatever it will be called after Mix restates MS tooling and its foothold on the desktop. I remember showing Expression Blend preview to a Sun Engineer a year ago and basically trying to convince him that this is what UI building in Swing/Java needs to get to.

    I still wouldn’t count Swing out. With Java 6 update N and the consumer JRE, there is still a window (albeit that gets shorter while at the same time sliding forward like doppler). Personally, I see the footprint for the enterprise space (non-consumer) in this order (without relative weighting): web, MS, Java, Adobe.Yep, b/c Adobe has fallen into the reinvent the wheel trap under the glitz of a damn good presentation engine. In 5 yrs, I think we will look back and ask what went wrong with them. I still think back with nostalgia at the possibility of having a bytecode compatibility in the flash player.

  10. Tim Goeke Says:

    Swing is great but there is another complication. The latest Mac OS does not run Java 6, unless you use the BSD port which is Soy Latte.

    There is a preview of SE 6, but it’s 64 bit only. That’s a problem if you’re one of many users who aren’t 64 (yet).

    Soy Latte can use X11 to display a Swing GUI, but this is suboptimal. Perhaps it’s time to take something like wxWidgets and create a modern cross platform JVM based UI toolkit.

    The current crop of alternate UI kits such as Fox or wxWidgets don’t support things like L&F, animation, etc. With all the examples out there, it should be possible to write a good GUI api that retains a humane interface.

    Maybe I’m crazy but I think that the best way to predict the future is to invent it. Is it time to create a community GUI toolkit with dynamic languages built in?

  11. Richard Osbaldeston Says:

    And how should we blame for this lack of interest – when the revolution comes I’d put Dion and Ben up against that wall for their Ajaxian evangelisation ;)

    I had a little dig about this yesterday (http://forums.java.net/jive/thread.jspa?messageID=259911#259911) the team seems so thinly-spread that theres no reserves to prioritize all the necessary work. So seemly niche things like nimbus (NIH), kernel jre, javafx and scenegraph (NIH) get the man hours while crucial things like beansbindings and appframework are left to fester alone and unloved. I’m sure someone will pipe in and say they’re JSRs, open source.. contribute.. but should they be? isn’t that just being cheap?

    Included the kernel and javafx in the niche bracket as I fail to see how given the prevalence of broadband how trickling the full jre is really a help. Ten years ago it might have stood a chance at making a difference – but it’s not download speeds putting the users off installing Java these days. JavaFX just smacks as another attempt at Applets it isn’t clear how it’d scale up to enterprise apps – I can only see it being used for the kinds of RIA Follies those same swing-developers curn out for JavaOne every year. Take two UI frameworks into the shower? it appears to me to divide the development effort of an already threadbare team. The ideas and animation are interesting, but what else suffers because of the resources being put into it?

    One of the things I’ve found puzzling is the almost complete lack of information on how to build enterprise level ui interfaces. The kind of bread and butter thing I’ve always believed developers are really doing (it’s not RIA calculator widgets is it?). How to get the client services work with the various app servers (often classloader hell), invoke session beans (other remoting protocols are available), what should the client do with ORM decorated collections passed via RMI, threading, responsiveness, transactions, deployment options & classloading. It’s like theirs a line client-side guys won’t cross (somewhere around a basic two-tier database JDBC/JPA app) and the same for server-side guys who”ll experiment and give up because its not like posting a html form. To survive I think Swing needs to embrace the tricky grown-up things that Ajax, Flex and others really can’t touch.

    BTW. Whatever happed to Spring RCP?

  12. Jesse Kuhnert Says:

    @Jonathan Giles:

    I’ve had the opposite reaction. Experience with other non swing gui toolkit/frameworks made me dislike swing even more.

  13. Robert Johnson Says:

    I am currently working on a Swing application that is being used at close to 2000 retail locations by the company I work for. It was in development for over three years. One thing Swing doesn’t come with is a framework that you can use to create large enterprise applications so we ended up creating one ourselves. Anyway, I prefer programming in Swing to any other GUI toolkit (SWT, MFC) and to web programming.

  14. Trey Says:

    Spring RCP is alive and well. I see new commits coming in on a regular basis and have been using it for many different projects. All it lacks is good documentation.
    I highly recommend the Spring Rich Client Project for building well-structured Swing apps.

  15. Faria Says:

    I would have nearly believe the tagline “Swing is drowning”, if I hadn’t been involved with the development of an end-user application, with an enormous amount of user interface, in the last year, and hadn’t seen in being developed very smoothly.
    When we show the application that we have build, people usually don’t believe it’s Java (you have to show them the task manager so that they see it’s a Java process). And it worked with only *very few bugs to fix* on Windows, Mac and GTK.

    Strangely, 2 years ago, I would have agreed that Swing was drowning; now I don’t anymore. Part of if comes that I now believe what I see, but also, I think that Swing has simply matured: less bugs, less strange behaviors on different platforms…

    Rather than “swing is drowning”, I think we currently can saw “swing is thriving”.

    Now, it doesn’t mean that there can’t be other great enviroments: Eclipse RCP, WinForm… WinForm is probably best actually, a mix of simplicity, and beauty. But if you want to do complex stuff, and crossplatform, Swing is *still* thriving.

  16. Stephane Grenier Says:

    AS Faria described, I think Swing is maturing. It’s a great framework to build desktop application in. Once you get your head around it it’s very intuitive. And you can see it’s where many of the web frameworks such as JSF are heading to.

    And I also agree, if done right, most Swing apps don’t look like Java apps at all. They have that much power. If you look at our app (http://www.LandlordMax.com), unless you looked at install folder, you’d have no idea it’s a Swing based application!

  17. Joe Says:

    One project I’ve been kicking around is a weird kind of richtext editor/browser…long story short, the best way to implement it is to build a custom text storage class. Swing allows that. I don’t know of any other gui toolkit that does.

    Tragically, I also want multimedia editing for the same project, and for that Java provides bupkis. So I have to go to another platform, and put more work into the text system, because I definitely can’t do the media from scratch.

  18. Jonathan Watmough Says:

    I’ve come to JVM/Swing through the Clojure language, and I love the combination of Swing and NetBeans for quickly building really nice GUIs. It seems like the hardware has finally caught up with the software, and I have built some UIs that run across all platforms Mac OS X, Linux, Windows, and on 1.5 and 1.6 that work just great.

    I’m not sure this is really possible on any other platform. For example, Winforms in Mono does not yet work on OS X. I haven’t found a cross platform language that has a platform-consistent Gtk binding … etc etc

  19. Tim McClarren Says:

    “Perhaps it’s because I have little experience in GUI frameworks outside of Swing, but I find it incredibly intuitive and powerful.”

    I think that says it all. Everyone I know who has not spent time in any other application framework finds Swing to be intuitive and powerful. Swing was pretty awful from the start and never got better (it doesn’t even deliver events to the application in a consistent order across platforms… wasn’t that the whole promise of write-once, run-everywhere?)

    Maybe they’ve fixed that since I last used it 5 years ago. I kinda doubt it.

    I’d probably pick Qt over anything else if I wanted a solid application framework and cared about XP issues. It’s much better designed than Swing.

  20. Fred S Says:

    “Complexity stems from Java’s power” – NOT. There is no intrinsic need for such astounding GUI complexity in making simple programs.

  21. miranda Says:

    very good
    buy xanax

  22. gary Says:

    Why do people think java swing is complex? I rather think these people who called themselves “developers/programmers” are simply the laziest people in the work force. Give me some api and drag and drop… Add some getters and setters. oh yeah. now pay me the big $$!! Ppl learn something worth while. remember computer science you learned from school? you want complexity and poor oo design, go with MFC. The only issue I see swing is a bit overly flexible hence the added complexity. Learn the event dispatch thread, that all you need. nothing complicated. People are simply too lazy to try to understand the technology. Technology? There’s nothing new in swing. Remember X/Motif? of course not.

    Why are so many server programmers? I call them getters and setters. Haha, design pattern… what a joke. try using it in swing. Read the holub pattern book. J2EE my a**. Yeah, the container will do everything for you… Any moron can do server code. XML/EJB/JMS…. tell me something new. All recycled technologies with bloated overhead from the old days.

    I am not against JEE. I am against the people who think they know better. sigh

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: What are the first four letters in the word British?