ch.sahits.game.graphic.layout
Class TextInput

java.lang.Object
  extended by ch.sahits.game.graphic.layout.AbstractSahitsComponent
      extended by ch.sahits.game.graphic.layout.AbstractEditableSahitsComponent<String>
          extended by ch.sahits.game.graphic.layout.TextInput
All Implemented Interfaces:
ISahitsComponent, IUpdatableComponent

public class TextInput
extends AbstractEditableSahitsComponent<String>
implements IUpdatableComponent


Field Summary
private  boolean drawCarret
           
private  boolean hasFocus
           
private  FontMetrics metric
           
private  int size
           
private  int TEXT_INSET
           
private  int updateCouter
           
 
Fields inherited from class ch.sahits.game.graphic.layout.AbstractSahitsComponent
painter
 
Constructor Summary
TextInput(FontMetrics fm)
           
 
Method Summary
 void gameRender(Graphics gScr)
          Force the panel to render itself.
 void gameUpdate()
          Force the panel to update its state.
 Dimension getPreferredSize()
          Retrieve the preferred size of the component.
 void paint(Graphics g)
          Draw the component with the appropriate graphic context.
 void setSize(int size)
           
 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
private  void updateValue(String s)
           
 
Methods inherited from class ch.sahits.game.graphic.layout.AbstractEditableSahitsComponent
getFont, getValue, setFont, setValue
 
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

size

private int size

updateCouter

private int updateCouter

hasFocus

private boolean hasFocus

drawCarret

private boolean drawCarret

metric

private final FontMetrics metric

TEXT_INSET

private final int TEXT_INSET
See Also:
Constant Field Values
Constructor Detail

TextInput

public TextInput(FontMetrics fm)
Method Detail

setSize

public void setSize(int size)

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:

gameRender

public void gameRender(Graphics gScr)
Description copied from interface: IUpdatableComponent
Force the panel to render itself.

Specified by:
gameRender in interface IUpdatableComponent
Parameters:
gScr - Graphics used for the rendering

gameUpdate

public void gameUpdate()
Description copied from interface: IUpdatableComponent
Force the panel to update its state.

Specified by:
gameUpdate in interface IUpdatableComponent

testClick

public void testClick(Point p)
Description copied from interface: IUpdatableComponent
Test if there was a mouse click on the component

Specified by:
testClick in interface IUpdatableComponent

testKeyPress

public void testKeyPress(KeyEvent e)
Description copied from interface: IUpdatableComponent
Check the updatable components if the key press was in one of them

Specified by:
testKeyPress in interface IUpdatableComponent

updateValue

private void updateValue(String s)


Copyright © 2011 Sahits GmbH. All Rights Reserved.