javamorph
Class CPictureDecorator

java.lang.Object
  extended by javamorph.CPictureDecorator
All Implemented Interfaces:
IDecorator

public class CPictureDecorator
extends Object
implements IDecorator

Version:
1.1
Author:
claus.erhard.wimmer@googlemail.com
Program: JavaMorph V 1.1.
Class: CPictureDecorator.
License: GPLv2.
Description: Draw one of both input pictures into the component.
Hint: Scaling is necessary depending on relation between width & height.

Field Summary
private  int height
          Height of the image in screen pixel units.
private  BufferedImage image
          Image from file to draw.
private  CFrame parent
          JComponent to draw the picture to.
private  int width
          Width of the image in screen pixel units.
private  int x
          X position of the top left corner in screen pixel units.
private  int y
          Y position of the top left corner in screen pixel units.
 
Constructor Summary
CPictureDecorator(CFrame parent, BufferedImage image)
          Constructor.
 
Method Summary
 Rectangle getBounds()
          Get function.
 void paint(Graphics g)
          Draw the picture to the Graphics context of the parent JComponent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

private CFrame parent
JComponent to draw the picture to.


image

private BufferedImage image
Image from file to draw.


x

private int x
X position of the top left corner in screen pixel units.


y

private int y
Y position of the top left corner in screen pixel units.


width

private int width
Width of the image in screen pixel units.


height

private int height
Height of the image in screen pixel units.

Constructor Detail

CPictureDecorator

public CPictureDecorator(CFrame parent,
                         BufferedImage image)
Constructor.

Parameters:
parent - Graphical component to draw the picture to.
image - Input picture of the own side.
Method Detail

paint

public void paint(Graphics g)
Draw the picture to the Graphics context of the parent JComponent.

Specified by:
paint in interface IDecorator
Parameters:
g - Graphics context of the JComponent.

getBounds

public Rectangle getBounds()
Get function.

Returns:
Image bounds in screen pixel units.