The point is missed

Museum of public mistakes and unfinished projects

Buy me a Beer :)

with 11 comments

 * The file is licenced under Revision 42 of the Beerware Licence.
 * <joakim.ohlrogge[at]> wrote this file. As long as you retain this
 * notice you can do whatever you want with this stuff. If we meet some day,
 * and you think this stuff is worth it, you can buy me a beer in return.
 * -- Joakim Ohlrogge

I decided to make the source for my DSL available under the beerware license. I choose beerware for several reasons:

  1. I don’t have the energy to turn his into a full blown traditional open source project.
  2. I believe that libraries without restrictions would make making GUI’s in Scala more appealing if you only need to convince whoever you need to convince that using Scala is a good idea and not having to deal with additional licensing issues imposed by some guy on a power-trip (me)
  3. I would need a hand if this should turn into something really useful and I invite any of you to without restrictions take this initiative further and perhaps even tweak it into your own library with or without my help.
  4. This project has been about learning for me, I hope it can help others learn too from it.

That I give it away like this does not mean that I’m not interested in what you do with it or use it for. I’m very curious so if you have the energy to do so, keep me posted! But you don’t have to.

I attach a zip with the code in it’s current state. It’s perhaps not pretty but it’s what I have so far. Enjoy the code!


Written by johlrogge

January 28, 2009 at 10:29 pm

Posted in scala, SWT

Tagged with ,

11 Responses

Subscribe to comments with RSS.

  1. That is a cool license. Thanks for your effort.

    One question now with Qt4 available as LGPL. Do you think SWT is still “useful” for Scala developers? I mean this is all about starting new applications and I am wondering if maybe Qt4 might be the best choice available (in terms of platform integration, third party widgets etc).

    I have to admit I am not in expert in any of those UI toolkits. I have used mainly VCL (Delphi), VB6 Crap and Windows Forms (C#/.Net) but would like to switch to a nice cross-platform kit.


    January 29, 2009 at 10:49 am

  2. Good question, I honestly don’t know. I hadn’t event heard about Qt4 before I read your comment. I would have to look in to it some more. The reason I started looking into simplifying SWT is that somewhere in time I want to be able to make plugins for eclipse in Scala. Eclipse is an area where I don’t feel that there will be any competition from Qt but for other areas it looks interesting.

    I think the DSL technique I’m using is feasible for anything hierarchical so I guess Qt-GUIS could be built in similar ways. The question then is if it adds anything to Qt. I read that the code is supposed to be highly readable so maybe a DSL would add very little?


    January 29, 2009 at 11:56 am

  3. Highly Readable? Where did I say that? ;)

    Well when talking to some people (not experts) I usually hear “Java is slow and ugly” when I tell them that Scala is a “better Java” using the same JVM. I think Java would today be a much stronger language/platform on the desktop if Sun hadn’t built something horrible as Swing (which is slow and ugly) ;) And now scala.swing is in the main Scala distribution, how awful is that. It is weird – language designers have such a good eye for beautiful language constructs but such a bad one for UI toolkits ;)

    I started a program in Delphi and learned how long you have to suffer from bad platform decisions. As I am not in any rush at the moment I am just wondering which toolkit to build my next application on :)

    I’ll try your DSL approach once my studies are finished (3 more weeks to go).


    January 29, 2009 at 12:39 pm

  4. QtJambi (Java Bindings for Qt) is easy to use: Add two jar files in your classpath, a platform dependent one and a generic one. That’s it. There exists a nice GUI designer, which I like much better than any Swing or SWT designer. However Qt works with a signals and slots mechanism which is different to other Java UI frameworks.
    Maybe a Qt port for SWT is the key road to heaven?

    Mike Greifeneder

    January 29, 2009 at 5:31 pm

  5. Interesting thread, apparently people *really* want Qt-support from SWT, that is interesting, is it *that* good? I’m definately interested.

    About Java-bindings. It’s one jar more than with SWT *but* dependency management is hardly the tricky part with GUI’s. When it comes to ease of use it’s all about how the components are designed. I would have to look into that since that is the part that interests me.

    GUI-designers do not interest me that much, I have never had a good experience with any I tried (and I lost interest in them before I started playing with swing). A DSL such as glimmer (that I have been trying to imitate in Scala with some success) seems much more interesting. However, I recognize that my GUI designer experience is way past it’s best before date so I should maybe just shut it and allow the possibility to be pleasantly surprised by the last couple of years developments in the field.

    It would be an interesting experiment to see if my GUI example can be built with QT and what the difference would be like.

    Thanks Daniel and Mike for opening my eyes to QT.

    Daniel: You never said QT was readable but they do on their homepage :))

    Also, beware of some people bashing java for performance issues. In my experience those are experts in other fields giving their reasons for not converting to java 10 years ago as valid advice today 10 years later (pretty much like me and FP). In reality there are some really cool optimizations that can be done in a VM that are too tedious to be practically feasible to be done outside a VM. Though startup times tend to mess up benchmarks of the hello world kind server performance tend to be pretty good. Especially in a high performance VM such as JRockit.

    You’re right though that java has never quite cut it on the client side with Swing, it’s getting better and better though and there are some good exceptions like intelliJ Idea. The lates net-beans that was hardly usable 5 years ago (IMHO) is actually quite good today (to my big surprise).

    But I have a feeling you know all this already and I’m preaching to the quire… (nasty habit)

    Anyway, thanks a lot for pointing me to QT, will check it out.


    January 29, 2009 at 8:02 pm

  6. Well at work i use a lot SWT/JFace and we only need to support one platform which is windows, so that works fine.
    First thing:
    Comments about Swing beeing slow and “ugly” are absolutly not true.
    There are actually some realy nice things for swing , e.g. google for the java mediaplayer example from the miglayout guy!
    Its also possible to load you Applications with diffrent “looks”, i tried that one on netbeans and it looks really cool!
    Second thing:
    I certainly had the Experience that if you come from SWT go over to JFace and finally discover RCP it all makes sense. SWT is the absolute basic layer which… “works” but is not to comfortable for me. JFace/Viewer and other predefined stuff is very nice. RCP pushes Desktop or “Rich Client” Develeopment to a complete diffrent level.
    Netbeans has also Netbeans Platform but the Modules are not OSGi driven and i think the API is more difficult to use, maybe thats jsut because i’m more used to Eclipse RCP. But still its not bad and much better then QT /Jambi..
    I have read some article…
    the event API looks “diffrent” so diffrent that someone has to prove to me that it works better that than SWT/Swing Action Models.

    For me Swing represents _really_ cross-platform UI-Stuff, while SWT is the choice for 1 platform with performance or other requirements.

    To find an End: I thank you :
    Joakim Ohlrogge
    for sharing this Code and your experience about it!


    January 29, 2009 at 8:15 pm

  7. JavaNovice:

    Thanks for your input, I’ve read a lot of Swing/SWT-debates and performance-wise the results seem inconclusive. It’s hard to measure perceived performance reliably (perceived vs actual performance is what matters in the end). I agree with you about netbeans, it’s not soggy at all.
    I have never quite come to peace with Swings look and feel, at least not for “blending in” as a native application. There tends to be subtle (and sometimes not so subtle) differences that give Swing away but cool stuff like skinned media-players etc are easier to do with look and feel.

    I looked at QT yesterday and I agree that the event-mechanism is a bit unusual. I see obvious benefits with it when it comes to implementing “signaling events” since you get all the logic for subscribing and signaling for free. It has a bit of a magic reflection to it. I think that part would be more elegant in Scala since you could simply pass in a function rather than a string describing the function. Overall I have mixed feelings about QT, the object-model is sometimes quite nice. Some interesting choices they have made make sense but I would have to use it more to have an opinion worthy of consideration.

    About the code:
    You and everyone else are welcome. Thanks for looking into it and thanks for the feedback!


    January 30, 2009 at 7:32 am

  8. Nice timing. Just a few days ago I read that Qt/Jambi is now officially discontinued by Nokia. It’s a shame really. I tried it and it really worked nicely. So back to SWT.

    Finished my studies now, so I finally have time to play with this. I am setting up a blog these days and will share my Swt-Scala code there, too. I mainly pimped the swt-libraries to allow easier event handling. I would assume for a really nice swt-scala-package we would need a “Scalafication” at a lower level (which I have started) and a higher-level language like yours on top of it. So are you still interested in creating an OpenSource project?

    JavaNovice: Most of my experience comes from Ubuntu, where Swing has three immediately visible issues:
    – Sometimes windows stay blank (you have to close and reopen them).
    – Font rendering looks different from native dialogs
    – Window resizing lags (On Gnome windows are supposed to be resized without any flicker using double buffering).

    That’s where I got my impressions. Back when I used Windows XP I had similar experiences, but maybe Swing has improved on XP, I don’t know.

    Daniel Lehmann

    February 21, 2009 at 4:06 pm

  9. Daniel,

    That is a bit strange. Is it only the Jambi part that is discontinued or all of QT? I currently do not have the energy to open source this. Luckily, the beer ware license allows others to do that and someone has done that on github. There is also another SWT-framework that borrows some from my ideas, some from the same sources as me and I bet adds some new ones. XScalaWT. I posted some links here:

    Check it out and good luck!


    February 26, 2009 at 10:20 pm

  10. Hey, is your Library still available on the internet (the like above is broken)?
    I’d like to use it for a project and extend it during the project to cover more of SWT. I would also like to add features for some JFace components, especially for Tree and Table, which could be much easier to use with higher order functions for content providers and label providers.

    Christoph Wulf

    September 6, 2010 at 5:04 pm

    • I have not put the source anywhere myself but others did (it was just an experiment from my side so I’m happy others found it worthwhile to refine/borrow my ideas). There is the XScalaSWT-library that borrowed some ideas for solutions to their library here: and my source was added to git-hub and develped further by someone here:

      I don’t know if the libraries are still developed or how they differ from eachother. I hope this helps.


      September 6, 2010 at 8:11 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: