Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
This paste will be private.
include Java import java.awt.event.ActionListener import javax.swing.JButton import javax.swing.JFrame class JButton def action_performed(&block) add_action_listener(ActionListener.impl {|sym, *args| block.call(args[0]) }) end end button = JButton.new("hello") frame = JFrame.new("frame") frame.set_size(200,200) frame.add button frame.show button.action_performed {|event| event.source.text = 'goodbye'}
From the Design Piracy series on my blog: