org.zaval.lw
Interface Drawable

All Superinterfaces:
Layoutable, Validationable
All Known Subinterfaces:
LwComponent, LwComposite, LwContainer, LwDesktop, LwLayer

public interface Drawable
extends Validationable, Layoutable

Defines the interface for classes that know how to paint itself. The interface provides set of properties that are bound with painting process.


Method Summary
 java.awt.Color getBackground()
          Gets the background color of this drawable component.
 java.awt.Point getOrigin()
          Returns an origin of the drawable component.
 boolean isEnabled()
          Determines whether this drawable component is enabled.
 boolean isOpaque()
          Gets the opaque of this drawable component.
 void paint(java.awt.Graphics g)
          Paints this drawable component.
 void repaint()
          Performs repainting process of this drawable component.
 void repaint(int x, int y, int w, int h)
          Performs repainting process of the specified rectangular area of this component.
 void setOpaque(boolean b)
          Sets the opaque of this drawable component.
 void update(java.awt.Graphics g)
          Updates this drawable component.
 
Methods inherited from interface org.zaval.util.Validationable
invalidate, isValid, validate
 
Methods inherited from interface org.zaval.lw.Layoutable
getBounds, getHeight, getInsets, getLocation, getPreferredSize, getSize, getWidth, getX, getY, isVisible, setLocation, setSize
 

Method Detail

paint

public void paint(java.awt.Graphics g)
Paints this drawable component.
Parameters:
g - the graphics context to be used for painting.

update

public void update(java.awt.Graphics g)
Updates this drawable component. The calling of the method precedes the calling of paint method and it is performed with repaint method. The method can be used to fill the drawable component with the background color if the component is opaque.
Parameters:
g - the specified context to be used for updating.

repaint

public void repaint()
Performs repainting process of this drawable component. The method causes calling of update and than paint methods.

repaint

public void repaint(int x,
                    int y,
                    int w,
                    int h)
Performs repainting process of the specified rectangular area of this component. The method causes calling of update and than paint methods.
Parameters:
x - the x coordinate.
y - the y coordinate.
w - the width.
h - the height.

isOpaque

public boolean isOpaque()
Gets the opaque of this drawable component. If the method returns false than the component is transparent, in this case update method is not be called during painting process.
Returns:
true if the component is opaque; otherwise false.

setOpaque

public void setOpaque(boolean b)
Sets the opaque of this drawable component. Use false argument value to make a transparent component from this component.
Parameters:
b - the opaque flag.

getOrigin

public java.awt.Point getOrigin()
Returns an origin of the drawable component. The origin defines an offset of the component view relatively the component point of origin. The method can be implemented to organize scrolling of the drawable component view.
Returns:
an origin of the component.

getBackground

public java.awt.Color getBackground()
Gets the background color of this drawable component.
Returns:
a componen background color.

isEnabled

public boolean isEnabled()
Determines whether this drawable component is enabled. If the method returns true than the drawable component is enabled and can participate in event handling and performing processes. Drawable components are enabled initially by default.
Returns:
true if the drawable component is enabled; false otherwise.


Copyright © Zaval Creative Engineering Group, 2000-2005.
http://www.zaval.org