Writing a desktop application with JRuby and Swing

Darkness is a Darkroom-like clone, that runs on JRuby with Java Swing.

To get a feel for it simply:

$ git clone https://github.com/jondot/darkness
$ cd darkness
$ jruby darkness.rb

Then remember this:

  • ESC quits.
  • Use CTRL(Command)-L, CTRL(Command)-S to load and save.

Whats It Like?

The purpose of darkness was educational; to provide a showcase of converting an old demo app from Java to JRuby. However, it is fully usable and can become a cross platform, lightweight, alternative to those who want to write distraction free.

Converting your existing Swing application from Java to JRuby is very possible. I've started doing this with zero knowledge of referencing Java from my JRuby powered code. I've learnt everything on the fly.

Take a look at the sources of both the original and the JRuby version. You may like the reduction in code size and readability and tempted to do the same for your apps. I've also included in comments some pitfalls I've fallen into.

if you havn't yet given JRuby a run, you should definitely go for it: http://www.jruby.org/