Wednesday, December 13, 2006

JRuby 0.9.2 released!

JRuby 0.9.2 is released.  JRuby is an 100% pure-Java implementation of the excellent Ruby programming language.  The latest version can be downloaded here.

Below is an example using JRuby and SWT:


require 'java'
include_class %w(Display Shell Label).map {|clss| "org.eclipse.swt.widgets.#{clss}"}
include_class "org.eclipse.swt.layout.FillLayout"
include_class "org.eclipse.swt.SWT"

display = Display.new

shell = Shell.new display
shell.set_text "My First JRuby/SWT App"
shell.set_size 200, 200
shell.set_layout FillLayout.new
Label.new(shell,SWT::NONE).set_text "Hello, World!"

shell.open
while not shell.is_disposed
display.sleep unless display.read_and_dispatch
end

No comments: