Skip to content

Instantly share code, notes, and snippets.

@claudiug
Created August 5, 2016 22:18
Show Gist options
  • Save claudiug/84ab98cf1babd9b05548486eb6f03f48 to your computer and use it in GitHub Desktop.
Save claudiug/84ab98cf1babd9b05548486eb6f03f48 to your computer and use it in GitHub Desktop.
require 'java'
java_import java.lang.System
Frame = javax.swing.JFrame
Button = javax.swing.JButton
Label = javax.swing.JLabel
frame = Frame.new("what")
button = Button.new("a button")
label = Label.new
button.add_action_listener do
label.text = System.get_property('java.home')
end
frame.content_pane.layout = java.awt.FlowLayout.new
frame.content_pane.add(button)
frame.content_pane.add(label)
frame.set_default_close_operation(Frame::EXIT_ON_CLOSE)
frame.set_size(500, 100)
frame.visible = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment