jme.geometry.hud
Interface Component

All Known Implementing Classes:
AbstractComponent

public interface Component

Component defines the base level object for the heads up display and/or graphical user interface elements. The component is intended to be heirarchical and allow for components to be added to the parent component.

Author:
Mark Powell

Method Summary
 void add(Component subComponent)
          add adds a specified component as a child of this component.
 boolean contains(int x, int y)
          contains returns true if the given point is within the constraints of the component.
 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 subtracts the specified component from the list of children.
 void render()
          render takes care of displaying the component to the screen.
 void setColor(float r, float g, float b)
          setColor sets the 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 transparency of the component where 0 is completely transparent and 1 is completely opaque.
 

Method Detail

add

public void add(Component subComponent)
add adds a specified component as a child of this component. The child components will always be rendered after the parent. The children will be rendered on top of the parent.

Parameters:
subComponent - the child component.

remove

public void remove(Component subComponent)
remove subtracts the specified component from the list of children. This will call dispose on the child, and subsequently all its children.

Parameters:
subComponent - the compoent to delete.

contains

public boolean contains(int x,
                        int y)
contains returns true if the given point is within the constraints of the component. Useful for things such as mouse placement.

Parameters:
x - the x coordinate of the tested point.
y - the y coordinate of the tested point.
Returns:
true if the point is contained within the component, false otherwise.

setColor

public void setColor(float r,
                     float g,
                     float b)
setColor sets the color of the component. The values of the red, green and blue components are expected to be between 0 and 1.

Parameters:
r - the red component of the color.
g - the green component of the color.
b - the blue component of the color.

setTransparency

public void setTransparency(float a)
setTransparency sets the transparency of the component where 0 is completely transparent and 1 is completely opaque.

Parameters:
a - the alpha value of the component.

setTexture

public void setTexture(java.lang.String texture)
setTexture sets the texture if any of the component.

Parameters:
texture - the texture image that defines the texture of the component.

setSize

public void setSize(float width,
                    float height)
setSize sets the size of the component.

Parameters:
width - the width of the component.
height - the height of the component.

setLocation

public void setLocation(float x,
                        float y)
setLocation sets the lower left point of the 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)
isVisible determines if the component and it's children are rendered. If the component is not visible it's children are also not visible.

Parameters:
value - if true the component and it's children are rendered, otherwise not.

getWidth

public int getWidth()
getWidth returns the current width of the component.

Returns:
the current width of the component.

getHeight

public int getHeight()
getHeight returns the current height of the component.

Returns:
the current height of the component.

getX

public int getX()
getX returns the current x location of the component. Where the location is defined by the lower left point.

Returns:
the x coordinate of the lower left point.

getY

public int getY()
getY returns the current y location of the component. Where the location is defined by the lower left point.

Returns:
the y coordinate of the lower left point.

dispose

public void dispose()
dispose destroys the component and all it's children.


render

public void render()
render takes care of displaying the component to the screen.