Class: ImageVoodoo::JImagePanel

Inherits:
Object
  • Object
show all
Defined in:
lib/image_voodoo/awt.rb

Overview

A simple swing wrapper around an image voodoo object.

Instance Method Summary collapse

Constructor Details

#initialize(image, x = 0, y = 0) ⇒ JImagePanel

Returns a new instance of JImagePanel.



60
61
62
63
# File 'lib/image_voodoo/awt.rb', line 60

def initialize(image, x=0, y=0)
  super()
  @image, @x, @y = image, x, y
end

Instance Method Details

#getPreferredSizeObject



70
71
72
# File 'lib/image_voodoo/awt.rb', line 70

def getPreferredSize
  java.awt.Dimension.new(@image.width, @image.height)
end

#image=(image) ⇒ Object



65
66
67
68
# File 'lib/image_voodoo/awt.rb', line 65

def image=(image)
  @image = image
  invalidate
end

#paintComponent(graphics) ⇒ Object



74
75
76
# File 'lib/image_voodoo/awt.rb', line 74

def paintComponent(graphics)
  graphics.draw_image(@image.to_java, @x, @y, nil)
end