daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # This is the 'magical Java include line'.
  2. include Java
  3.    
  4. # With the 'include Java' above, we can now refer to things that
  5. #are part of the standard Java platform via their full paths.
  6. # Creating a Java JFrame.
  7. frame = javax.swing.JFrame.new("Window")
  8. label = javax.swing.JLabel.new("Hello")
  9.    
  10. # We can transparently call Java methods on Java objects, just
  11. # as if they were defined in Ruby.
  12. frame.getContentPane.add(label)  # Invoking the getContentPane
  13. frame.setDefaultCloseOperation(
  javax.swing.JFrame::EXIT_ON_CLOSE)
  14. frame.pack
  15. frame.setVisible(true)
RAW Paste Data
Top