mhframework.gui
Class MHGUIStatusIndicator

java.lang.Object
  extended by mhframework.gui.MHGUIComponent
      extended by mhframework.gui.MHGUIStatusIndicator
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseListener, java.util.EventListener, MHRenderable

public class MHGUIStatusIndicator
extends MHGUIComponent

Provides a rectangular status indicator similar to a progress bar.


Field Summary
 
Fields inherited from class mhframework.gui.MHGUIComponent
focusable, height, state, width
 
Constructor Summary
MHGUIStatusIndicator()
          Constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void advance()
          Not currently used.
 float getMaxValue()
           
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void render(java.awt.Graphics2D g)
          Draws the status indicator onto the sent Graphics object.
 void setBarColor(java.awt.Color c)
          Sets the color of the progress bar.
 void setBorderColor(java.awt.Color c)
          Sets the color of the border around the component.
 void setFont(java.awt.Font font)
           
 void setMaxValue(int max)
          Sets the maximum value that this status indicator can represent.
 void setOrientation(boolean horiz)
          Sets the orientation of the component to horizontal or vertical.
 void setPaint(java.awt.GradientPaint grad)
          Sets an optional gradient paint with which to color the progress bar.
 void setText(java.lang.String text)
          Sets the text for the component's caption.
 void setTextColor(java.awt.Color c)
          Sets the color of the component's caption.
 void update(float newValue)
          Updates the value represented by the progress bar.
 
Methods inherited from class mhframework.gui.MHGUIComponent
getBounds, getHeight, getWidth, getX, getY, hasFocus, isEnabled, isVisible, mouseDragged, mouseEntered, mouseExited, paint, setEnabled, setFocus, setFocusable, setHeight, setPosition, setSize, setVisible, setWidth, setX, setY, updateBounds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MHGUIStatusIndicator

public MHGUIStatusIndicator()
Constructor.

Method Detail

setBarColor

public void setBarColor(java.awt.Color c)
Sets the color of the progress bar. This color will be used only if no gradient paint is defined.

Parameters:
c - The color to use for the progress bar.

setBorderColor

public void setBorderColor(java.awt.Color c)
Sets the color of the border around the component.

Parameters:
c - The color to use for the border rectangle.

setTextColor

public void setTextColor(java.awt.Color c)
Sets the color of the component's caption.

Parameters:
c - The color to use for the caption.

setOrientation

public void setOrientation(boolean horiz)
Sets the orientation of the component to horizontal or vertical.

Parameters:
horiz - True if component is to be drawn horizontally, false if it is to be drawn vertically.

setPaint

public void setPaint(java.awt.GradientPaint grad)
Sets an optional gradient paint with which to color the progress bar. If a gradient paint is not specified, the color set by setBarColor() will be used.

Parameters:
grad - An existing GradientPaint object to be used for coloring the progress bar.

setMaxValue

public void setMaxValue(int max)
Sets the maximum value that this status indicator can represent.

Parameters:
max - The maximum value of this indicator.

setText

public void setText(java.lang.String text)
Sets the text for the component's caption.

Parameters:
text - The text to appear over the indicator.

update

public void update(float newValue)
Updates the value represented by the progress bar.

Parameters:
newValue - The new value represented by the bar.

advance

public void advance()
Not currently used. Can be overridden by subclasses who may want to animate the bar or provide some other autonomous functionality.


render

public void render(java.awt.Graphics2D g)
Draws the status indicator onto the sent Graphics object.

Parameters:
graphics - The Graphics object on which to draw the indicator.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Overrides:
actionPerformed in class MHGUIComponent

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener
Specified by:
mouseClicked in class MHGUIComponent

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener
Specified by:
mousePressed in class MHGUIComponent

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener
Specified by:
mouseReleased in class MHGUIComponent

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in class MHGUIComponent

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in class MHGUIComponent

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in class MHGUIComponent

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in class MHGUIComponent

setFont

public void setFont(java.awt.Font font)

getMaxValue

public float getMaxValue()
Returns:
the maxValue