ch.sahits.game.graphic.layout
Class RadioButton

java.lang.Object
  extended by ch.sahits.game.graphic.layout.AbstractSahitsComponent
      extended by ch.sahits.game.graphic.layout.AbstractSelectableComponent
          extended by ch.sahits.game.graphic.layout.RadioButton
All Implemented Interfaces:
ISahitsComponent, IUpdatableComponent

public class RadioButton
extends AbstractSelectableComponent

Implementable selecteable Radio button. This component is a single selectable.

Author:
Andi Hotz, (c) Sahits GmbH, 2011 Created on Jun 9, 2011

Field Summary
private  SelectableGroup group
           
private  String text
           
 
Fields inherited from class ch.sahits.game.graphic.layout.AbstractSahitsComponent
painter
 
Constructor Summary
RadioButton(SelectableGroup group, FontMetrics metric, Font f)
           
RadioButton(SelectableGroup group, JPanel panel, Font f)
           
 
Method Summary
 Dimension getPreferredSize()
          Retrieve the preferred size of the component.
 void paint(Graphics g)
          Draw the component with the appropriate graphic context.
 void setText(String text)
           
 void testClick(MouseEvent e)
           
 void testClick(Point p)
          Test if there was a mouse click on the component
 String toString()
           
private  void updateSelected(boolean selected)
          Update the selected state
 
Methods inherited from class ch.sahits.game.graphic.layout.AbstractSelectableComponent
gameRender, gameUpdate, getFont, getFontMetrics, isSelected, setFont, setSelected, testKeyPress
 
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, wait, wait, wait
 

Field Detail

group

private final SelectableGroup group

text

private String text
Constructor Detail

RadioButton

public RadioButton(SelectableGroup group,
                   JPanel panel,
                   Font f)

RadioButton

public RadioButton(SelectableGroup group,
                   FontMetrics metric,
                   Font f)
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.


getPreferredSize

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

Returns:

setText

public void setText(String text)

updateSelected

private void updateSelected(boolean selected)
Update the selected state

Parameters:
selected -

testClick

public void testClick(MouseEvent e)

testClick

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


toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 Sahits GmbH. All Rights Reserved.