Sha256: 9e93240fb89bad1c5a2ed7f0cc106641176252d2e10350c5cad4bf6c8b3d31d1

Contents?: true

Size: 753 Bytes

Versions: 3

Compression:

Stored size: 753 Bytes

Contents

require 'mouse'


class MouseDraw
  
  def self.go
  
  require 'java'

  java_import 'javax.swing.JFrame'
  java_import 'javax.swing.JButton'
  java_import 'com.sun.awt.AWTUtilities'

  f = JFrame.new
  f.add JButton.new('capture window')
  f.set_size(200,200)

  AWTUtilities.set_window_opacity(f, 0.5)
  
  # wait till mouse goes down...
  while(Mouse.left_mouse_button_state == :up)
    sleep 0.05
    print '.'
  end
  f.undecorated = true
  f.default_close_operation = JFrame::EXIT_ON_CLOSE
  f.always_on_top = true
  f.visible = true
  f.set_location(Mouse.get_mouse_location)
  while(Mouse.left_mouse_button_state == :down)
    # set_size
  end
  #f.close
end
  
end


if $0 == __FILE__
  MouseDraw.go
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sensible-cinema-0.25.3 lib/mouse_draw.rb
sensible-cinema-0.25.2 lib/mouse_draw.rb
sensible-cinema-0.25.1 lib/mouse_draw.rb