Class: ImageVoodoo::JImagePanel
- Inherits:
-
Object
- Object
- ImageVoodoo::JImagePanel
- Defined in:
- lib/image_voodoo/awt.rb
Overview
A simple swing wrapper around an image voodoo object.
Instance Method Summary collapse
- #getPreferredSize ⇒ Object
- #image=(image) ⇒ Object
-
#initialize(image, x = 0, y = 0) ⇒ JImagePanel
constructor
A new instance of JImagePanel.
- #paintComponent(graphics) ⇒ Object
Constructor Details
#initialize(image, x = 0, y = 0) ⇒ JImagePanel
Returns a new instance of JImagePanel.
38 39 40 41 |
# File 'lib/image_voodoo/awt.rb', line 38 def initialize(image, x=0, y=0) super() @image, @x, @y = image, x, y end |
Instance Method Details
#getPreferredSize ⇒ Object
48 49 50 |
# File 'lib/image_voodoo/awt.rb', line 48 def getPreferredSize java.awt.Dimension.new(@image.width, @image.height) end |
#image=(image) ⇒ Object
43 44 45 46 |
# File 'lib/image_voodoo/awt.rb', line 43 def image=(image) @image = image invalidate end |
#paintComponent(graphics) ⇒ Object
52 53 54 |
# File 'lib/image_voodoo/awt.rb', line 52 def paintComponent(graphics) graphics.draw_image(@image.to_java, @x, @y, nil) end |