ch.sahits.game.graphic.layout
Class AbstractMultiselectableComponent<T>

java.lang.Object
  extended by ch.sahits.game.graphic.layout.AbstractSahitsComponent
      extended by ch.sahits.game.graphic.layout.AbstractMultiselectableComponent<T>
All Implemented Interfaces:
ISahitsComponent, IUpdatableComponent
Direct Known Subclasses:
Slider, Spinner

public abstract class AbstractMultiselectableComponent<T>
extends AbstractSahitsComponent
implements IUpdatableComponent


Field Summary
private  Font font
           
protected  ArrayList<T> selectables
           
private  int selectedIndex
           
private  boolean update
           
 
Fields inherited from class ch.sahits.game.graphic.layout.AbstractSahitsComponent
painter
 
Constructor Summary
AbstractMultiselectableComponent()
           
 
Method Summary
 void add(T item)
           
 void decSelection()
           
 void gameRender(Graphics gScr)
          Force the panel to render itself.
 void gameUpdate()
          Force the panel to update its state.
 Font getFont()
          Retrieve the font
 T getItem(int index)
           
 int getItemCount()
           
 T getSelected()
           
 int getSelectedIndex()
           
 void incSelection()
           
 void setFont(Font f)
          Set the font
 void setSelected(int index)
           
 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
 
Methods inherited from interface ch.sahits.game.graphic.display.IUpdatableComponent
testClick
 
Methods inherited from interface ch.sahits.game.graphic.display.ISahitsComponent
getPreferredSize, paint
 

Field Detail

font

private Font font

selectables

protected ArrayList<T> selectables

selectedIndex

private int selectedIndex

update

private boolean update
Constructor Detail

AbstractMultiselectableComponent

public AbstractMultiselectableComponent()
Method Detail

add

public void add(T item)

getSelected

public T getSelected()

incSelection

public void incSelection()

decSelection

public void decSelection()

getSelectedIndex

public final int getSelectedIndex()

getItemCount

public final int getItemCount()

getItem

public T getItem(int index)

setSelected

public void setSelected(int index)

getFont

public Font getFont()
Description copied from interface: ISahitsComponent
Retrieve the font

Specified by:
getFont in interface ISahitsComponent
Returns:

setFont

public void setFont(Font f)
Description copied from interface: ISahitsComponent
Set the font

Specified by:
setFont in interface ISahitsComponent

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

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


Copyright © 2011 Sahits GmbH. All Rights Reserved.