mhframework.gui
Class MHGUILabel

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

public class MHGUILabel
extends MHGUIComponent

Custom label component class.


Field Summary
protected  java.awt.Paint DEFAULT_PAINT
          Default color if no other color is specified.
protected  java.awt.Paint disabledPaint
          The paint used to color the label when it's disabled.
protected  java.awt.Font font
          The font of the text displayed on the label.
protected  java.awt.Paint paint
          The paint used to color the label when it's enabled.
protected  java.lang.String text
          The text displayed on the label.
 
Fields inherited from class mhframework.gui.MHGUIComponent
focusable, height, state, width
 
Constructor Summary
MHGUILabel()
           
MHGUILabel(java.lang.String caption)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void advance()
          Tells an object to update its data.
 void centerOn(java.awt.geom.Rectangle2D r, java.awt.Graphics2D g2d)
           
 java.awt.Font getFont()
           
 java.lang.String getText()
           
 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)
          Tells an object to draw itself onto the sent Graphics object.
 void setDisabledPaint(java.awt.Paint p)
           
 void setFont(java.awt.Font f)
           
 void setPaint(java.awt.Paint p)
           
 void setText(java.lang.String caption)
           
 void updateBounds(java.awt.Graphics2D g2d)
          Updates the bounds of the label using the layout of the current font
 
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
 

Field Detail

DEFAULT_PAINT

protected final java.awt.Paint DEFAULT_PAINT
Default color if no other color is specified.


font

protected java.awt.Font font
The font of the text displayed on the label.


text

protected java.lang.String text
The text displayed on the label.


paint

protected java.awt.Paint paint
The paint used to color the label when it's enabled.


disabledPaint

protected java.awt.Paint disabledPaint
The paint used to color the label when it's disabled.

Constructor Detail

MHGUILabel

public MHGUILabel()

MHGUILabel

public MHGUILabel(java.lang.String caption)
Method Detail

setFont

public void setFont(java.awt.Font f)

getFont

public java.awt.Font getFont()

setText

public void setText(java.lang.String caption)

setPaint

public void setPaint(java.awt.Paint p)

setDisabledPaint

public void setDisabledPaint(java.awt.Paint p)

advance

public void advance()
Description copied from interface: MHRenderable
Tells an object to update its data.


render

public void render(java.awt.Graphics2D g)
Description copied from interface: MHRenderable
Tells an object to draw itself onto the sent Graphics object.

Parameters:
g - The Graphics object on which this object is to draw itself.

centerOn

public void centerOn(java.awt.geom.Rectangle2D r,
                     java.awt.Graphics2D g2d)

updateBounds

public void updateBounds(java.awt.Graphics2D g2d)
Updates the bounds of the label using the layout of the current font


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

getText

public java.lang.String getText()
Returns:
the text