org.zaval.lw
Class LwImgRender
java.lang.Object
|
+--org.zaval.lw.LwView
|
+--org.zaval.lw.LwRender
|
+--org.zaval.lw.LwImgRender
- All Implemented Interfaces:
- Validationable
- public class LwImgRender
- extends LwRender
This class implements image render that knows how to draw the target java.awt.Image object.
It is possible to render whole image or only specified part of the targer image object.
|
Constructor Summary |
LwImgRender(java.awt.Image img,
int type)
Constructs the render with the specified target image and the view type. |
LwImgRender(java.awt.Image img,
int x,
int y,
int w,
int h,
int type)
Constructs the render with the specified target image, the view type and
the specified rectangular image part that should be rendered. |
LwImgRender(java.lang.String name)
Constructs the render with the specified target image name. |
LwImgRender(java.lang.String name,
int type)
Constructs the render with the specified target image name and the view type.
|
LwImgRender(java.lang.String name,
int x,
int y,
int w,
int h,
int type)
Constructs the render with the specified target image name, the view type and
the specified rectangular image part that should be rendered. |
|
Method Summary |
protected java.awt.Dimension |
calcPreferredSize()
Calculates and returns the view preferred size. |
java.awt.Image |
getImage()
Gets the target image object that is painted with the render. |
void |
paint(java.awt.Graphics g,
int x,
int y,
int w,
int h,
Layoutable d)
Paints the view using the given width and height. |
| Methods inherited from class org.zaval.lw.LwView |
getBottom, getLeft, getPreferredSize, getRight, getTop, getType, invalidate, isValid, ownerChanged, paint, recalc, setType, validate |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LwImgRender
public LwImgRender(java.awt.Image img,
int type)
- Constructs the render with the specified target image and the view type.
- Parameters:
img - the specified target image to be rendered.type - the specified view type.
LwImgRender
public LwImgRender(java.lang.String name)
- Constructs the render with the specified target image name. The name is
a path to the image file relatively LwVCL resources base (see the LwToolkit.getResourcesBase method)
directory. The constructor sets MOSAIC view type as default.
- Parameters:
name - the specified image name.
LwImgRender
public LwImgRender(java.lang.String name,
int type)
- Constructs the render with the specified target image name and the view type.
The name is a path to the image file relatively LwVCL resources base
(see the LwToolkit.getResourcesBase method) directory.
- Parameters:
name - the specified image name.type - the specified view type.
LwImgRender
public LwImgRender(java.lang.String name,
int x,
int y,
int w,
int h,
int type)
- Constructs the render with the specified target image name, the view type and
the specified rectangular image part that should be rendered.
- Parameters:
name - the specified target image name.x - the x coordinate of the top left corner the rendered part of the image.y - the y coordinate of the top left corner the rendered part of the image.w - the width the rendered part of the image.h - the height the rendered part of the image.type - the specified view type.
LwImgRender
public LwImgRender(java.awt.Image img,
int x,
int y,
int w,
int h,
int type)
- Constructs the render with the specified target image, the view type and
the specified rectangular image part that should be rendered.
- Parameters:
img - the specified target image to be rendered.x - the x coordinate of the top left corner the rendered part of the image.y - the y coordinate of the top left corner the rendered part of the image.w - the width the rendered part of the image.h - the height the rendered part of the image.type - the specified view type.
getImage
public java.awt.Image getImage()
- Gets the target image object that is painted with the render.
- Returns:
- a target image object.
paint
public void paint(java.awt.Graphics g,
int x,
int y,
int w,
int h,
Layoutable d)
- Paints the view using the given width and height. The location where the
view has to be painted is determined with
x and y
coordinates.
- Overrides:
paint in class LwView
- Parameters:
g - the specified context to be used for painting.x - the x coordinate.y - the y coordinate.w - the width of the view.h - the height of the view.d - the owner component.
calcPreferredSize
protected java.awt.Dimension calcPreferredSize()
- Calculates and returns the view preferred size. The render returns the target image
size as the "pure" preferred size.
- Overrides:
calcPreferredSize in class LwView
- Returns:
- a "pure" preferred size of the view.
|