lib/swing_helpers.rb in sensible-cinema-0.16.5 vs lib/swing_helpers.rb in sensible-cinema-0.16.7
- old
+ new
@@ -16,20 +16,25 @@
set_font Font.new("Tahoma", Font::PLAIN, 11)
end
def on_clicked &block
raise unless block
+ @block = block
add_action_listener do |e|
begin
- block.call
- rescue Exception => e
- puts 'got fatal exception', e
- puts e.backtrace.join("\n")
- System.exit(1) # LODO no exit
- end
+ block.call
+ rescue Exception => e
+ puts 'got fatal exception', e
+ puts e.backtrace.join("\n")
+ System.exit(1) # LODO no exit
+ end
end
self
end
+
+ def simulate_click
+ @block.call
+ end
end
class JFrame
def close
\ No newline at end of file