|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectch.sahits.game.graphic.layout.AbstractSahitsComponent
ch.sahits.game.graphic.layout.Button
public class Button
| Field Summary | |
|---|---|
private Runnable |
action
|
private Font |
font
|
private int |
H_BORDER
|
private FontMetrics |
metric
|
private String |
text
|
private int |
V_BORDER
|
| Fields inherited from class ch.sahits.game.graphic.layout.AbstractSahitsComponent |
|---|
painter |
| Constructor Summary | |
|---|---|
Button(FontMetrics fm)
|
|
| Method Summary | |
|---|---|
void |
gameRender(Graphics gScr)
Force the panel to render itself. |
void |
gameUpdate()
Force the panel to update its state. |
Font |
getFont()
Retrieve the font |
Dimension |
getPreferredSize()
Retrieve the preferred size of the component. |
String |
getText()
|
void |
paint(Graphics g)
Draw the component with the appropriate graphic context. |
void |
setAction(Runnable run)
|
void |
setFont(Font f)
Set the font |
void |
setText(String text)
|
void |
testClick(Point p)
Test if there was a mouse click on the component |
void |
testKeyPress(KeyEvent e)
Check the updatable components if the key press was in one of them |
| 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 |
| Field Detail |
|---|
private Font font
private final FontMetrics metric
private String text
private int V_BORDER
private int H_BORDER
private Runnable action
| Constructor Detail |
|---|
public Button(FontMetrics fm)
| Method Detail |
|---|
public void gameRender(Graphics gScr)
IUpdatableComponent
gameRender in interface IUpdatableComponentgScr - Graphics used for the renderingpublic void gameUpdate()
IUpdatableComponent
gameUpdate in interface IUpdatableComponentpublic void paint(Graphics g)
ISahitsComponent
paint in interface ISahitsComponentpublic Dimension getPreferredSize()
ISahitsComponent
getPreferredSize in interface ISahitsComponentpublic Font getFont()
ISahitsComponent
getFont in interface ISahitsComponentpublic void setFont(Font f)
ISahitsComponent
setFont in interface ISahitsComponentpublic void testClick(Point p)
IUpdatableComponent
testClick in interface IUpdatableComponentpublic void testKeyPress(KeyEvent e)
IUpdatableComponent
testKeyPress in interface IUpdatableComponentpublic String getText()
public void setText(String text)
public void setAction(Runnable run)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||