Thursday, December 2, 2010

Presentation and Webstart demo

Here we go again,

today i'll give a little talk about creating graphical rich custom components in Swing at the Java User Group of Dusseldorf aka rheinjug.

This talk is not about complex algorithms or rocket science etc. but more i'll try to show you how you can use different techniques to create good looking stuff in Java Swing.

Some things are similar to the stuff i talked about a year ago at our Java User Group in Muenster but you know...that was last year...things change...

In the meantime i created the FXG converter which is my workhorse when creating new components because it makes things much easier if you don't have to code all the graphics stuff by hand.

With the new power of the converter at my hand i was able to create the steelseries component library in the last months and in the talk i explain my workflow and the tools i use to realize it.

The presentation is available for download as pdf, powerpoint and keynote file:

   pdf:              ForgottenPowerOfSwing.pdf

   powerpoint:   ForgottenPowerOfSwing.ppt

   keynote:       ForgottenPowerOfSwing.key

In addition to this it's also available as an online html version.

The slides where it says "Demo" are linked to youtube movies so that you get an impression about the stuff i show today live in the talk.
You will also find a link to a little demo app that i use to test the steelseries library.

I use the app behind the webstart demo to test the library, so it's not a full blown demo but it works ok. 

There's one thing i'm currently working on which is the initialization of the components. There's a problem with component size at initialization time which you could see if you start the webstart demo. All gauges will appear in their preferredSize() first and will then be shrinked to the size their got from the layout manager. If anyone has a hint on that...please enlighten me...

That's all i want to tell you today...

keep coding...


  1. I was (i would still like to be) a Java Swing dev.
    but i have to say with sorrow is outdated.
    What you show here in NOT Swing is Java2D no ?

  2. Well for me Java2D is part of Swing and i think it's not really outdated yet. If you take a look at all the enterprise software out in the field you will find tons of swing based ui's that will be still in the field for the next years. I agree that there are new/improved technologies like html5 canvas which might replace many ui toolkits (not only swing).
    I also agree to Chet's answer...if you would like to do something for yourself...just do it, that's the reason why i build the steelseries library...

  3. What you've done is very nice !!!
    I would really want Swing not to be outdated but when i need to do a thing from scratch only the thought of doing it in Swing makes me tired (despite i have all the know how) when i think how easy it can be done with some of the alternatives.
    You can do anything in Swing , sky is the limit BUT we have one enemy time (productivity)

  4. Agreed and that's the reason why i built the FXGConverter which saves me from coding all the graphics by hand... :-)

  5. Just took a look an other articles you worte here.
    Nice things , time counter , the menu ...just made me rethink how many nice things can be done in swing :)
    Maybe i will try to do someting after all just to share with others as you do.
    My first thought is a very nice data grid...
    BTW: follow you on twitter from today.

  6. Great.. Loved to be Swing/Jav2D programmer. Nice demo.

    God Bless..

  7. Hello,
    This is amazing what you are doing with Java2D.
    I just to want to give you a hint that I forked out of the Substance Look and Feel the svg converter and improved it a lot.
    With this you can convert SVG images to Java2D code.
    Perhaps this is interesting for your audience that has no Adobe products but uses open source software like Inkscape or any other SVG capable program.

    This converter can be found at

    When I find the time I will dig into your FXG converter and perhaps steal some good ideas from it.

    Perhaps it would make sense to merge both into a single tool?

    I'm currently experimenting with a Java2D context that is a "grabber" to produce a stream of Java2D painting commands. This can then be optimised and then played back against another Java2D context / writer.
    For example render a PDF to the recorder optimise it and then play it back against a "Java2D Sourcecode writer". With this approach you could generate Java2D code from everything that you find a Graphics2D based renderer for.

    Have fun
    - Rossi

  8. Hi Bernd,
    Thanx for the hint. I like the idea if a combined tool and will take a look at it.

  9. It looks good and runs well. It's really a shame that there is no Java Store front like Chrome Web Store to allow Java developers to post all those good apps.

  10. Got an error trying to launch the webstart demo (I'm behind firewall) Unable to load resource:

  11. The error occurs with Firefox. Demo runs fine with IE 6 !

  12. You might want to check the connection settings in Firefox because they could be different from the system internet connection settings. I use webstart a lot from behind a firewall and firefox is not a problem at all...if you have the right settings... :-)

    You might also find some useful information here:

  13. Hi,
    Thanks for the presentation..very informative.
    Have a few queries

    1: To my understanding from the ppt,any part of the image which is dynamic should be put into its own layer (BufferedImage) ? Is this the reason the webstart demo takes close to 100mb?

    2:What do u suggest would be the approach for less complex java2d like a pulsating button ?


  14. Also for a pulsating button you could apply this method (check out In general it depends on the complexity of the image. If it's less complex you might also draw it directly in the paintComponent() method.
    Cheers, Gerrit

  15. Nice presentation, I just did a fxg with Fireworks, ready for next steps (it will take me some days, depending on works and parties :p).
    To come back on what Bernd has said, before using Fireworks I was searching on a more "open". I found Inkscape in open vector editors but it doesnt support fxg right now. A french guy is working on it (svg to fxg via xslt), he said the script will be in release 0.49 of inkscape(in 1 year at minimum) but he'll provide an experimental version next week. You can follow his progress here :

  16. Well if i'll find some time i'll try to add the svg to java2d converter from substance to the tool, but i can't say how long it will take...

  17. Is the only solution in reducing the memory consumption,is to reduce the no of layers(BufferedImages) ?

  18. Hello:
    Where i can find any documentation different form javadoc does not help so much, the code of the demo will be very usefull

  19. Hi, great job!! i am very thankfull, but i have to ask a question : ¿when you call paintComponent your first line is repaint()?? it is giving me problems with composite panels with some components...
    HAve fun

  20. Hi, i am working in a small electronic software
    Well, i found something interesting, i generally do layout with composite panels(without IDE), when i was testing the LinearBarGraph i put an instance of it in a JPanel, and the JPanel in a JFrame, the result was that the LinearBarGraph does not show, but when i put it directly on the JFrame and it shows..... after my lunch time , i set the layout of the JPanel to BorderLayout and the LinearBarGraph works.... the circular gauges always works fine with composite panels ¿can you review it?

  21. Hi David,
    Did you use the latest version 3.7.1? I will take a look at it tomorrow, thanx for the hint.