ch.sahits.game.graphic.layout
Class Label

java.lang.Object
  extended by ch.sahits.game.graphic.layout.AbstractSahitsComponent
      extended by ch.sahits.game.graphic.layout.Label
All Implemented Interfaces:
ISahitsComponent, ISahitsLabel

public class Label
extends AbstractSahitsComponent
implements ISahitsLabel


Field Summary
private  Font font
           
private  FontMetrics metric
           
private  String text
           
 
Fields inherited from class ch.sahits.game.graphic.layout.AbstractSahitsComponent
painter
 
Constructor Summary
Label(FontMetrics fm)
           
 
Method Summary
 Font getFont()
          Retrieve the font
 Dimension getPreferredSize()
          Retrieve the preferred size of the component.
 void paint(Graphics g)
          Draw the component with the appropriate graphic context.
 void setFont(Font f)
          Set the font of the label
 void setText(String text)
          Set the text of the label
 
Methods inherited from class ch.sahits.game.graphic.layout.AbstractSahitsComponent
createVisualBounds, getBounds, getInsets, setBounds, setInsets
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ch.sahits.game.graphic.display.ISahitsComponent
getBounds, setBounds, setInsets
 

Field Detail

text

private String text

font

private Font font

metric

private final FontMetrics metric
Constructor Detail

Label

public Label(FontMetrics fm)
Method Detail

paint

public void paint(Graphics g)
Description copied from interface: ISahitsComponent
Draw the component with the appropriate graphic context. Before calling this method make sure it is appropriately initialized.

Specified by:
paint in interface ISahitsComponent

getPreferredSize

public Dimension getPreferredSize()
Description copied from interface: ISahitsComponent
Retrieve the preferred size of the component.

Specified by:
getPreferredSize in interface ISahitsComponent
Returns:

getFont

public Font getFont()
Retrieve the font

Specified by:
getFont in interface ISahitsComponent
Returns:

setText

public void setText(String text)
Description copied from interface: ISahitsLabel
Set the text of the label

Specified by:
setText in interface ISahitsLabel

setFont

public void setFont(Font f)
Description copied from interface: ISahitsLabel
Set the font of the label

Specified by:
setFont in interface ISahitsComponent
Specified by:
setFont in interface ISahitsLabel


Copyright © 2011 Sahits GmbH. All Rights Reserved.