Class: DrawPanel

Inherits:
JPanel show all
Includes:
MouseMotionListener
Defined in:
lib/roebe/jruby/swing/paint_demo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#draw_xObject

Returns the value of attribute draw_x.



13
14
15
# File 'lib/roebe/jruby/swing/paint_demo.rb', line 13

def draw_x
  @draw_x
end

#draw_yObject

Returns the value of attribute draw_y.



13
14
15
# File 'lib/roebe/jruby/swing/paint_demo.rb', line 13

def draw_y
  @draw_y
end

Instance Method Details

#mouse_dragged(event) ⇒ Object Also known as: mouseDragged



17
18
19
20
21
# File 'lib/roebe/jruby/swing/paint_demo.rb', line 17

def mouse_dragged(event)
  @draw_x = event.x
  @draw_y = event.y
  repaint
end

#mouse_moved(event) ⇒ Object Also known as: mouseMoved



22
23
24
25
26
# File 'lib/roebe/jruby/swing/paint_demo.rb', line 22

def mouse_moved(event)
  @draw_x = event.x
  @draw_y = event.y
  repaint
end

#paint_component(graphics) ⇒ Object Also known as: paintComponent



14
15
16
# File 'lib/roebe/jruby/swing/paint_demo.rb', line 14

def paint_component(graphics)
  graphics.draw_oval(@draw_x, @draw_y, 10, 10)
end