The Artima Developer Community
Sponsored Link

Weblogs Forum
Puppets Do JRuby

3 replies on 1 page. Most recent reply: May 30, 2008 4:23 PM by David Koontz

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Bruce Eckel

Posts: 875
Nickname: beckel
Registered: Jun, 2003

Puppets Do JRuby (View in Weblogs)
Posted: Dec 9, 2007 4:00 PM
Reply to this message Reply
Summary
Jeremy Meyer and I put this together from start to finish in one afternoon, using puppets to show the basics of making JRuby calls into Java.
Advertisement

Be warned: this was a sprint and we were using most of the tools for the first time. We used a still camera with video capability to capture the video, which probably accounts for the aspect ratio.

Link to YouTube page

That's Jeremy playing the ukulele. We used iMovie to edit it together.


Wilfred Springer

Posts: 176
Nickname: springerw
Registered: Sep, 2006

Re: Puppets Do JRuby Posted: Dec 11, 2007 12:03 AM
Reply to this message Reply
I love it. We need more puppetcasts.

Wilfred Springer

Posts: 176
Nickname: springerw
Registered: Sep, 2006

Re: Puppets Do JRuby Posted: Dec 11, 2007 12:04 AM
Reply to this message Reply
... or pupcasts.

David Koontz

Posts: 3
Nickname: dkoontz
Registered: May, 2008

Re: Puppets Do JRuby Posted: May 30, 2008 4:23 PM
Reply to this message Reply
I know this post is pretty old and I'm sure you've learned more about JRuby but I wanted to stick some notes on here for people just learning about JRuby via this video.

1. You don't need include_class for java or javax packages. You could have done JFrame = javax.swing.JFrame. If you wanted to import your own package, com.bruceeckel.foo you would need to put that in quotes, i.e. include_class 'com.bruceeckel.foo'. The reason it worked in your example is that JRuby knows what javax is and thus resolved it for you. A third (hah, Ruby's all about choice right!) is to use Java::com::bruceeckel::foo and that will work for any arbitrary package.

2. You don't need parentheses on setSize just like you didn't need them for setVisible or the call to JFrame.new. You can use either set_size or setSize, JRuby preserves the original Java name.

3. For single arg get/set methods JRuby gives you a far more Ruby'ish method. setVisible becomes visible = and getVisible becomes just visible. So your last line would be "frame.visible = true"

Flat View: This topic has 3 replies on 1 page
Topic: Puppets Do JRuby Previous Topic   Next Topic Topic: Is bad software really my fault?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use