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.
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
#getPreferredSize ⇒ Object
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 |