Sha256: 6b6f41d990a56343b0d29612d5000d57203e5febd0d8e65fd09b47af78b44b6c

Contents?: true

Size: 664 Bytes

Versions: 17

Compression:

Stored size: 664 Bytes

Contents

require 'java'

class RubyClip
  import java.awt.datatransfer.StringSelection;
  import java.awt.Toolkit;

  include java.awt.datatransfer.ClipboardOwner
  def self.set_clipboard to_this
    stringSelection = StringSelection.new( to_this.to_s )
    clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
    clipboard.setContents( stringSelection, self );
  end
  
  def self.lostOwnership(aClipboard, aContents) 
     # ignore...
  end
  
end

if $0 == __FILE__
  RubyClip.set_clipboard "from jruby1"
  puts 'set clipboard contents...'
  RubyClip.set_clipboard "from jruby2"
  RubyClip.set_clipboard "from jruby3"
  STDIN.getc
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
sensible-cinema-0.28.0 lib/ruby_clip.rb
sensible-cinema-0.27.0 lib/ruby_clip.rb
sensible-cinema-0.26.3 lib/ruby_clip.rb
sensible-cinema-0.26.2 lib/ruby_clip.rb
sensible-cinema-0.26.1 lib/ruby_clip.rb
sensible-cinema-0.26.0 lib/ruby_clip.rb
sensible-cinema-0.25.4 lib/ruby_clip.rb
sensible-cinema-0.25.3 lib/ruby_clip.rb
sensible-cinema-0.25.2 lib/ruby_clip.rb
sensible-cinema-0.25.1 lib/ruby_clip.rb
sensible-cinema-0.25.0 lib/ruby_clip.rb
sensible-cinema-0.24.9 lib/ruby_clip.rb
sensible-cinema-0.24.8 lib/ruby_clip.rb
sensible-cinema-0.24.7 lib/ruby_clip.rb
sensible-cinema-0.24.6 lib/ruby_clip.rb
sensible-cinema-0.24.5 lib/ruby_clip.rb
sensible-cinema-0.24.4 lib/ruby_clip.rb