Java desktop links of the week, August 3

Plenty of news this week, so lets get right into it.


  • Leonid Bogdanov emailed me with some code he has been working on, as he thought it would be useful for other readers. He wrote a simple class that allows for a Java application (on any platform) to determine if there is already an instance of the program running. I’m sure many of us have had to write similar code before, so perhaps this is useful to some people out there. There is no license specified in the source file, however feel free to use it however you wish – consider it to be public domain code.
  • Alex Ruiz posts about how he reorganised long unit test classes to be more readable and quicker to understand.
  • There was a bit of a discussion recently about ‘Project Lombok‘, which looks like quite an interesting project to cut down on having to write boilerplate code. I recommend you spend a few minutes to watch the video to understand what it does.




Have a great week everyone.

Java desktop links of the week, July 27

A fairly quiet week this week in Java desktop land, but nonetheless some interesting news. Perhaps everyone is taking a deep breath prior to an Oracle acquisition. Regardless, let’s get straight into this weeks Java desktop links of the week.


  • Cutting across both Swing and JavaFX is the need for good UI tests. The FEST project is one of the leaders in this area, and it is growing, with a number of new members this week alone. FEST is now looking to grow support for testing JavaFX user interfaces also.


  • Željko emailed me to say that his Revolución Movie Library 0.7 beta has been released. This application has been linked to before from here, as it shows off what is possible with Swing. Note that this is a closed source application that’ll eventually not be free, and the current download is a 30-day trial.
  • There is a discussion on whether component creation off of the EDT is really a bug. Frankly I didn’t even bother to read the article, as in my humble opinion it’s simple: anything relating to the UI should be performed on the EDT, and anything not relating to the UI should not be performed on the EDT (unless it is a very quick operation). It doesn’t get much more black and white than that.



That’s it for another week – hope you left a little wiser than when you entered. If not, demand your money back. Anywho, tune in next week – same bat-time, same bat-channel.

JavaFX Menubar control

To continue developing my JavaFX skills I put in a few hours over the last week to build a menubar control. For those unsure on what a menubar is, it is the row at the top of an applications window (on most operating systems) that has the ‘File’, ‘Edit’, ‘Help’, etc menus. The menubar control is therefore responsible for making it easy to add and remove menus and menu items from the menu. For anyone interested in the API for my menubar, you can read the code that must be written to build the menu shown below.

I’m not wanting to go on about it too much now, as it is still in very early development, but you can play with it here. You’ll need to be running a recent Java release to get the best results. Of course, don’t expect much – what you see in the screenshot below is all you get (along with a bit of interactivity). Click the screenshot for a bigger image.



I’m also aware that it is lacking 🙂 Features such as accelerators, mnemonics, grouped menu items, submenu arrows, checks on checked menu items are all coming (some faster than others). As well as this, there are some layout issues that I need to work out – in particular menu width improvements, submenu positioning (overlap), text alignment, etc. Update: Note that the crossed-out tasks have been completed.

For now it’s a tech demo (for me) – hopefully as time permits it may find time to become more polished, and possibly even usable!

JavaFX Particle-o-Rama Thoughts

Update: I have put up a new version of Particle-o-rama (still using my refactored code), but instead of applying effects to each individual partical, I apply the same effect to the group responsponsible for all particles. This, on my computer, is far more performant than Josh’s version, but looks the same (or very similar). </Update>

If you’re reading this blog, you’re probably well aware of Josh Marinacci’s Particle-o-rama project that he put out recently. It’s a simple particle simulator designed to put JavaFX through it’s paces (by throwing lots of independent nodes into the scenegraph). When it came out I was not very impressed by the speed of the animation, so I decided to look into it today. I should note that the video on the page linked to above shows it to be very performant on Josh’s Mac, so I’m not entirely sure why the same application doesn’t work well on my (equally powerful) Vista machine.

I ended up doing a decent refactoring of the code (which is what I tend to do to understand what is going on), but it turns out that the key issue is the use of JavaFX effects to blur the particles. By simply disabling three lines of code, the performance jumps considerably (on my machine a rough guide is by about 400%). This improvement also includes my other refactorings that would have improved the performance a little, but not anywhere near as much as the result of turning off effects.

You can compare my version to Josh’s version.

So, in summary, effects in JavaFX are still in some circumstances slow. If you are experiencing slow-downs in your code, try disabling any effects you have enabled and see if that helps.

Even with the improved speed of my version, it maxes out and starts to become laggy after about 400 nodes are visible. This is obviously not good enough, but it sounds like Sun are putting a lot of effort into improving performance in the next few releases of JavaFX. It will be good to keep testing performance in relation to both my version and Josh’s version of this particle simulator.

For those of you interested in how I cleaned up / refactored Josh’s code, you can see my version here. I kept the same general gist of Josh’s version, but binned a lot of unnecessary code, merged loops where possible, and extracted comparisons to be performed outside of loops where possible. Josh’s original code can be seen here.

Java desktop links of the week, July 19

Well, no surprises this week with the news that the Oracle acquisition of Sun has been approved by shareholders. With the next step being Government consideration, we can only wonder how much longer Sun will be around. All I hope is that Oracle does it’s best to continue developing relevant Java technologies, and keeps Java pretty much on the path it is on now.

This week has been oddly quiet in the Java desktop world. Regardless, here are the most important Java desktop links of the week.

P.S. For anybody out there interested in hearing more Java desktop news, remember to follow me on twitter.





That’s us for another week. As always, feel free to email me any links you think are relevant. Have a great week!