Skip to content

Instantly share code, notes, and snippets.

@keithrbennett
Last active August 29, 2015 13:58
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 keithrbennett/10275705 to your computer and use it in GitHub Desktop.
Save keithrbennett/10275705 to your computer and use it in GitHub Desktop.
Illustrates JRuby Swing Action issues.
require 'java'
java_import javax.swing.TransferHandler
java_import javax.swing.Action
cut = TransferHandler.getCutAction
puts "Cut action is an instance of class #{cut.class}."
cut.putValue('fruit', 'mango')
puts "retrieved fruit value = '#{cut.getValue('fruit')}'."
begin
cut.value('fruit')
rescue
puts "#{cut.class} does not have its getValue aliased to value."
end
=begin
Output is:
Cut action is an instance of class Java::JavaxSwing::TransferAction.
retrieved fruit value = ''.
Java::JavaxSwing::TransferAction does not have its getValue aliased to value.
in both JRuby 1.7.1 and 1.7.9
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment