A brief introduction and example of developing desktop application with Ruby programming language. JRuby and shoesrb is discussed as platform.
Prepared for and Presented on Ruby Conference Bangladesh 2003.
23. Why JRuby?
●
High performance
●
Real threading
●
Vast array of libraries (gems + JARs)
24. Why JRuby?
●
High performance
●
Real threading
●
Vast array of libraries (gems + JARs)
●
Platform Independent
25. Why JRuby?
●
High performance
●
Real threading
●
Vast array of libraries (gems + JARs)
●
Platform Independent
●
Enterprise Acceptance
26. Why JRuby?
●
High performance
●
Real threading
●
Vast array of libraries (gems + JARs)
●
Platform Independent
●
Enterprise Acceptance
The best of both worlds!
28. Get JRuby
●
Download
●
Extract
●
Add bin subdirectory to your $PATH
– (PATH=path/to/jruby/bin:$PATH)
●
Test it: jruby -v
●
Assuming you have jdk 1.7 installed
●
Can be installed with rvm too
30. Make a Frame (JFrame)
class NumberConverter < JFrame
def initialize
super('Number Format Converter')
set_size(400,140);
set_visible(true);
set_default_close_operation(JFrame::EXIT_ON_CLOSE);
end
end
num_converter = NumberConverter.new
40. Set Event Handler cont.
main.add(btn = Jbutton.new("CONVERT"));
btn.add_action_listener do |evt|
result.set_text(convert.upcase);
end
def convert
# Take the value of @input
# Take formats form @cmbFrom and @cmbTo
# Convert to required format
end
end # end of class NumFormat
50. BTW, JRuby is not ONLY for Desktop
●
It's just Ruby*
●
Rails just works
*Here are differences- https://github.com/jruby/jruby/wiki/DifferencesBetweenMriAndJruby