logo       

[jruby-user] ActionListener cannot be subclassed: msg#00132

lang.jruby.user

Subject: [jruby-user] ActionListener cannot be subclassed


Hi all,
I am trying one of the various jRuby/swing examples out there. But I allways
get a type error when I subclass ActionListener:

require ‘java‘
include_class ‘java.awt.event.ActionListener‘
include_class ‘javax.swing.JButton‘
include_class ‘javax.swing.JFrame‘

class ClickAction < ActionListener # exception here!!!
def actionPerformed(event)
puts “Button got clicked.“
end
end

class MainWindow < JFrame
def initialize
super “JRuby/Swing Demo“
setDefaultCloseOperation JFrame::EXIT_ON_CLOSE

button = JButton.new “Click me!“
button.addActionListener ClickAction.new
add button
pack
end
end
MainWindow.new.setVisible true

Any hints?
Thx
Clemens

--
View this message in context:
http://www.nabble.com/ActionListener-cannot-be-subclassed-tf4810366.html#a13763302
Sent from the JRuby - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise