I found what I think is a nice solution to this problem
I did find the define_handler method and played around with that a
bit, but here is what I did
In the controller I have the
add_listener :type => :mouse, :components => [:panel]
and a method
def mouse_clicked(event)
puts "event source = #{event.source}"
end
to handle mouse clicks to the panel
So I have been trying to figure out how to get listeners on to the
components I add to the view dyamically
In the view I now have something like this
panel_mouse_listeners = panel.get_mouse_listeners #get the mouse
listeners for the panel
....
a_check_box =
javax.swing.JCheckBox.new
panel_mouse_listeners.each do |listener|
a_check_box.add_mouse_listener listener
end
so I basically avoid the whole problem by just copying the mouse
listener references from the panel to the new components
Let me know if there is a better way, but this is good enough for my
test application
John