4 import javax.swing.JFrame
6 frame = JFrame.new("Hello Swing")
7 button = javax.swing.JButton.new("Klick Me!")
10 include java.awt.event.ActionListener
11 def actionPerformed(evt)
12 javax.swing.JOptionPane.showMessageDialog(nil, <<EOS)
13 <html>Hello from <b><u>JRuby</u></b>.<br>
14 Button '#{evt.getActionCommand()}' clicked.
18 button.add_action_listener(ClickAction.new)
20 # Add the button to the frame
21 frame.get_content_pane.add(button)
24 frame.set_default_close_operation(JFrame::EXIT_ON_CLOSE)
28 # Sleep the main thread, so we don't exit