JRubyProce55ingその1
今更って感じが、漂いますが、最近やる気がおきなくてプログラム組んでないのでリハビリ程度で。
以下参考
http://d.hatena.ne.jp/dewdrop/20070506/p5r
ゆの in Ruby を読む - gan2 の Ruby 勉強日記
上記を一先ずコピー。動かしてみる。
include Java require "core.jar" include_class "processing.core.PApplet" class Sketch < PApplet def setup size 320,280 background 255 no_stroke end def draw 30.times do fill random(255), random(255), random(255) rect random(width), random(height), 10, 10 end end def self.[] str include_package "javax.swing" frame = JFrame.new str applet = Sketch.new frame.add applet frame.setDefaultCloseOperation JFrame::EXIT_ON_CLOSE applet.init frame.pack frame.setVisible true end end Sketch["Sketch"]
おぉー、動く動く。簡単ですね。
って言うかRubyの特異クラス関連の動作の方がよく分からんw;
「ゆの in Ruby」読みながらちょっと復習。