Skip to content

Instantly share code, notes, and snippets.

@ivanoats
Created December 7, 2013 01:54
Show Gist options
  • Save ivanoats/7836370 to your computer and use it in GitHub Desktop.
Save ivanoats/7836370 to your computer and use it in GitHub Desktop.
require "java"
java_import javax.swing.JFrame
java_import javax.swing.JButton
java_import javax.swing.JOptionPane
class HelloWorld < JFrame
def initialize
super "Example"
setSize(150, 100)
setDefaultCloseOperation(JFrame::EXIT_ON_CLOSE)
setLocationRelativeTo(nil)
button = JButton.new("Say Hello")
add(button)
button.addActionListener do |e|
JOptionPane.showMessageDialog(nil, "Hello World")
end
setVisible(true)
end
end
HelloWorld.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment