jruby-swt-cookbook icon indicating copy to clipboard operation
jruby-swt-cookbook copied to clipboard

Examples for writing an application in JRuby/SWT

JRuby SWT Cookbook

JRuby and SWT is a great platform for writing cross-platform desktop applications. This repo contains examples of how to get started.

Why JRuby/SWT?

  • Fast, compatible Ruby implementation.
  • JRuby and SWT are flawlessly cross-platform.
  • SWT has native widgets (for the most part).
  • SWT powers Eclipse, so there's nothing you need that it doesn't do.
  • You don't need to touch Java! Write everything in Ruby.

Installation

You will need to run these examples with JRuby. Get it from jruby.org.

API Docs

The apidocs.tar.gz file contains SWT API reference docs. Untar the file and open apidocs/index.html in your browser. The comments in all the examples refers to files in these docs. They are the Java api, however JRuby does a great job of interfacing with Java, so you can usually just call into them as if they were Ruby classes and methods.

Running Examples

On Windows and Linux:

$ jruby ex1_button/ex1_button.rb

On OSX:

$ jruby -J-XstartOnFirstThread ex1_button/ex1_button.rb