Skip to content

Instantly share code, notes, and snippets.

@rdp
Created November 19, 2010 00:06
Show Gist options
  • Select an option

  • Save rdp/705923 to your computer and use it in GitHub Desktop.

Select an option

Save rdp/705923 to your computer and use it in GitHub Desktop.
code to reproduce
C:\dev\ruby\sensible-cinema\bin>..\..\downloads\jruby\bin\jruby.exe crash1.rb
RubyToJavaInvoker.java:221:in `findCallableArityOne': java.lang.ArrayIndexOutOfBoundsException: 1
from InstanceMethodInvoker.java:56:in `call'
from AliasMethod.java:61:in `call'
from CachingCallSite.java:313:in `cacheAndCall'
from CachingCallSite.java:152:in `call'
from crash1.rb:23:in `method__3$RUBY$initialize'
from crash1Invokermethod__3$RUBY$initializeFixed0#initialize:65535:in `call'
from CachingCallSite.java:303:in `cacheAndCall'
from CachingCallSite.java:121:in `callBlock'
from CachingCallSite.java:126:in `call'
from RubyClass.java:810:in `call'
from DynamicMethod.java:180:in `call'
from ConcreteJavaProxy.java:132:in `call'
from CachingCallSite.java:293:in `cacheAndCall'
from CachingCallSite.java:112:in `call'
from crash1.rb:37:in `__file__'
from crash1.rb:-1:in `load'
from Ruby.java:688:in `runScript'
from Ruby.java:571:in `runNormally'
from Ruby.java:414:in `runFromMain'
from Main.java:304:in `run'
from Main.java:144:in `run'
from Main.java:113:in `main'
#!/usr/bin/ruby
require 'java'
module SensibleSwing
include_package 'javax.swing'
[JButton, JFrame, JLabel, JPanel] # grab these constants (http://jira.codehaus.org/browse/JRUBY-5107)
include_package 'java.awt'
[FlowLayout, Font]
include_class 'java.awt.event.ActionListener'
end
module SensibleSwing
class MainWindow < JFrame
def initialize
super "Sensible-Cinema"
setDefaultCloseOperation JFrame::EXIT_ON_CLOSE
panel = JPanel.new
panel.set_layout nil
setSize 280,400
add panel # why can't I just slap these down?
jlabel = JLabel.new 'Welcome to Sensible Cinema'
font happy = Font.new("Tahoma", Font::PLAIN, 11)
jlabel.setFont(happy)
jlabel.set_bounds(44,44,136,14)
panel.add jlabel
b = JButton.new( "Play Hulu, Youtube, or a DVD" ).on_clicked {
self.close
#go_sc
}
b.set_bounds(44,120,173,23)
panel.add b
end
end
end
SensibleSwing::MainWindow.new.set_visible true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment