Skip to content

Instantly share code, notes, and snippets.

Created August 8, 2010 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/514557 to your computer and use it in GitHub Desktop.
Save anonymous/514557 to your computer and use it in GitHub Desktop.
#!/usr/bin/env jruby
# main.rb
require 'java'
java_import 'java.awt.Component'
java_import 'javax.swing.JOptionPane'
java_import 'javax.swing.SwingUtilities'
java_import 'TestJavaClient.SampleFrame'
class Main
java_signature 'void main(String[])'
def self.main(args)
sample_frame = SampleFrame.new
sample_frame.set_visible(true)
end
java_signature 'void inform( final Component parent, final String str)'
def self.inform(parent, str)
if SwingUtilities.event_dispatch_thread?
show_msg parent, str, JOptionPane::INFORMATION_MESSAGE
else
SwingUtilities.invoke_later {
show_msg parent, str, JOptionPane.INFORMATION_MESSAGE
}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment