jme.geometry.hud
Class AbstractComponent

java.lang.Object
  extended byjme.geometry.hud.AbstractComponent
All Implemented Interfaces:
Component
Direct Known Subclasses:
Button, Frame, Panel, Picker, ProgressBar, TextPanel

public abstract class AbstractComponent
extends java.lang.Object
implements Component

AbstractComponent defines a base level of implementation of the Component interface. The dispose and render methods must be implmented by the subclass.

Author:
Mark Powell

Field Summary
protected  float alpha
           
protected  java.util.ArrayList children
           
protected  Vector color
           
protected  float height
           
protected  int locationX
           
protected  int locationY
           
protected  float width
           
 
Constructor Summary
AbstractComponent()
           
 
Method Summary
 void add(Component subComponent)
          add places the subcomponent in the array list of children.
 boolean contains(int x, int y)
          contains reports true if the supplied point is within the constraints of the component.
abstract  void dispose()
          dispose destroys the component and all it's children.
 int getHeight()
          getHeight returns the current height of the component.
 int getWidth()
          getWidth returns the current width of the component.
 int getX()
          getX returns the current x location of the component.
 int getY()
          getY returns the current y location of the component.
 void isVisible(boolean value)
          isVisible determines if the component and it's children are rendered.
 void remove(Component subComponent)
          remove removes thes specified subComponent from this component.
abstract  void render()
          render takes care of displaying the component to the screen.
 void setColor(float r, float g, float b)
          setColor sets the overall color of the component.
 void setLocation(float x, float y)
          setLocation sets the lower left point of the component.
 void setSize(float width, float height)
          setSize sets the size of the component.
 void setTexture(java.lang.String texture)
          setTexture sets the texture if any of the component.
 void setTransparency(float a)
          setTransparency sets the alpha channel of the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

locationX

protected int locationX

locationY

protected int locationY

height

protected float height

width

protected float width

color

protected Vector color

alpha

protected float alpha

children

protected java.util.ArrayList children
Constructor Detail

AbstractComponent

public AbstractComponent()
Method Detail

add

public void add(Component subComponent)
add places the subcomponent in the array list of children. This list is not sorted in anyway.

Specified by:
add in interface Component
Parameters:
subComponent - the child to add to this component.
See Also:
Component.add(jme.geometry.hud.Component)

remove

public void remove(Component subComponent)
remove removes thes specified subComponent from this component. This effectively disposes the subcomponent as well as any children this child may have had.

Specified by:
remove in interface Component
Parameters:
subComponent - the child to remove.
See Also:
Component.remove(jme.geometry.hud.Component)

contains

public boolean contains(int x,
                        int y)
contains reports true if the supplied point is within the constraints of the component. If the point falls outside of the component false is returned.

Specified by:
contains in interface Component
Parameters:
x - the x value of the component.
y - the y value of the component.
Returns:
true if the point is within the component, false otherwise.
See Also:
Component.contains(int,int)

setColor

public void setColor(float r,
                     float g,
                     float b)
setColor sets the overall color of the component.

Specified by:
setColor in interface Component
Parameters:
r - the red value.
g - the green value.
b - the blue value.
See Also:
Component.setColor(float,float,float)

setTransparency

public void setTransparency(float a)
setTransparency sets the alpha channel of the component.

Specified by:
setTransparency in interface Component
Parameters:
a - the alpha value.
See Also:
Component.setTransparency(float)

setTexture

public void setTexture(java.lang.String texture)
Description copied from interface: Component
setTexture sets the texture if any of the component.

Specified by:
setTexture in interface Component
Parameters:
texture - the texture image that defines the texture of the component.

setSize

public void setSize(float width,
                    float height)
Description copied from interface: Component
setSize sets the size of the component.

Specified by:
setSize in interface Component
Parameters:
width - the width of the component.
height - the height of the component.

setLocation

public void setLocation(float x,
                        float y)
Description copied from interface: Component
setLocation sets the lower left point of the component.

Specified by:
setLocation in interface Component
Parameters:
x - the x coordinate of the lower left point.
y - the y coordinate of the lower left point.

isVisible

public void isVisible(boolean value)
Description copied from interface: Component
isVisible determines if the component and it's children are rendered. If the component is not visible it's children are also not visible.

Specified by:
isVisible in interface Component
Parameters:
value - if true the component and it's children are rendered, otherwise not.

getWidth

public int getWidth()
Description copied from interface: Component
getWidth returns the current width of the component.

Specified by:
getWidth in interface Component
Returns:
the current width of the component.

getHeight

public int getHeight()
Description copied from interface: Component
getHeight returns the current height of the component.

Specified by:
getHeight in interface Component
Returns:
the current height of the component.

getX

public int getX()
Description copied from interface: Component
getX returns the current x location of the component. Where the location is defined by the lower left point.

Specified by:
getX in interface Component
Returns:
the x coordinate of the lower left point.

getY

public int getY()
Description copied from interface: Component
getY returns the current y location of the component. Where the location is defined by the lower left point.

Specified by:
getY in interface Component
Returns:
the y coordinate of the lower left point.

dispose

public abstract void dispose()
Description copied from interface: Component
dispose destroys the component and all it's children.

Specified by:
dispose in interface Component

render

public abstract void render()
Description copied from interface: Component
render takes care of displaying the component to the screen.

Specified by:
render in interface Component