Created
December 7, 2013 01:54
-
-
Save ivanoats/7836370 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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