framework
Class RadioButtonElement

java.lang.Object
  extended by no.tellu.cdlc.gui.GuiElement
      extended by framework.RadioButtonElement
All Implemented Interfaces:
no.tellu.cdlc.gui.ElementListner

public class RadioButtonElement
extends no.tellu.cdlc.gui.GuiElement

RadioButtonelement.java

Draws radio buttons

The radio button alternatives are set in the choices vector by calling setChoices(Vector choices).

Pressing fire activates the radio button element. Selecting a different button is then done by pressing right/left.


Field Summary
 
Fields inherited from class no.tellu.cdlc.gui.GuiElement
ANY, DECIMAL, EMAILADDR, NUMERIC, PASSWORD, PASSWORD_NUMERIC, PHONENUMBER, URL
 
Constructor Summary
RadioButtonElement()
          Constructor RadioButtonElement
RadioButtonElement(java.lang.String elementId)
          Constructor RadioButtonElement
 
Method Summary
 void elementLayoutManager()
          Updates the width and the height of the RadioButtonElement
 boolean fire(int key)
          Activates the radio buttons if they're not, deactivates them otherwise.
 int getSelectedIndex()
           
 java.lang.String getStringValue()
           
 boolean moveLeft(int x)
          Handles the selection of radio buttons when the key for moving left is pressed.
 boolean moveRight(int x)
          Handles the selection of radio buttons when the key for moving right is pressed.
 void paint(javax.microedition.lcdui.Graphics g, boolean selected)
          Paints the radio buttons, their text and a dotted rectangle around the selected radio button.
 void setChoices(java.util.Vector choices)
          Sets the radio buttons' alternatives.
 
Methods inherited from class no.tellu.cdlc.gui.GuiElement
backPressed, callbackAction, changeFont, charPressed, clearButton, clearFields, contains, countCharactersToWidth, countCharactersToWidth, drawBorder, drawBorder, drawString, drawString, getComponentAt, getCurrGuiElement, getElement, getElementId, getFieldColour, getFieldType, getFont, getFontColour, getHeight, getHelpString, getInnerheight, getInnerWidth, getInsetBottom, getInsetLeft, getInsetRight, getInsetTop, getLabel, getLineColour, getMaxCharacters, getMaxHeight, getMaxWidth, getMinCharacters, getParent, getPreferredHeight, getPreferredWidth, getSoundFileName, getValue, getWidth, getWidtOfString, getWidtOfString, getX, getY, init, isAllElementsComplete, isBorderVisible, isEditable, isFocused, isHidden, isInputValidated, isLayoutNeeded, isMaximumSizeSet, isPreferredHeightSizeSet, isPreferredSizeSet, isPreferredWidhtSizeSet, isSelectable, isVisible, moveDown, moveToShow, moveUp, numberPressed, paint, paint, poundPressed, remove, replaceTabInString, setAutoLayout, setBorderVisible, setBounds, setDrawBackground, setEditable, setElementId, setElementListner, setElementPosition, setFieldType, setFocused, setFont, setFrameSize, setGroupElement, setHeight, setHelpString, setHidden, setInsetBottom, setInsetLeft, setInsetRight, setInsets, setInsetTop, setLabel, setLayoutNeeded, setLayoutNeeded, setMaxCharacters, setMaximumSize, setMinCharacters, setParent, setPreferredSize, setSelectable, setSize, setSoundFileName, setWidth, setX, setY, starPressed, truncate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RadioButtonElement

public RadioButtonElement()
Constructor RadioButtonElement


RadioButtonElement

public RadioButtonElement(java.lang.String elementId)
Constructor RadioButtonElement

Parameters:
elementId - The id of the object of this class
Method Detail

elementLayoutManager

public void elementLayoutManager()
Updates the width and the height of the RadioButtonElement

Overrides:
elementLayoutManager in class no.tellu.cdlc.gui.GuiElement

paint

public void paint(javax.microedition.lcdui.Graphics g,
                  boolean selected)
Paints the radio buttons, their text and a dotted rectangle around the selected radio button.

Overrides:
paint in class no.tellu.cdlc.gui.GuiElement

setChoices

public void setChoices(java.util.Vector choices)
Sets the radio buttons' alternatives.

Parameters:
choices - a vector containing string alternatives

getStringValue

public java.lang.String getStringValue()
Returns:
the alternative text of the selected radio button

getSelectedIndex

public int getSelectedIndex()
Returns:
the index of the selected radio button

moveLeft

public boolean moveLeft(int x)
Handles the selection of radio buttons when the key for moving left is pressed.

Overrides:
moveLeft in class no.tellu.cdlc.gui.GuiElement

moveRight

public boolean moveRight(int x)
Handles the selection of radio buttons when the key for moving right is pressed.

Overrides:
moveRight in class no.tellu.cdlc.gui.GuiElement

fire

public boolean fire(int key)
Activates the radio buttons if they're not, deactivates them otherwise.

Overrides:
fire in class no.tellu.cdlc.gui.GuiElement