PenProfile 2.x

com.livescribe.ext.ui
Class RadioMenu

java.lang.Object
  extended by com.livescribe.ext.ui.Menu
      extended by com.livescribe.ext.ui.RadioMenu

public class RadioMenu
extends Menu

A menu where only one item can be selected at once. Selected and not-selected items have an associated icon.

Since:
2.3

Nested Class Summary
 
Nested classes/interfaces inherited from class com.livescribe.ext.ui.Menu
Menu.MenuAction, Menu.MenuBrowseList, Menu.MenuItem, Menu.MenuListener
 
Constructor Summary
RadioMenu(String[] text, int selectedIndex, Display display)
          Creates a new menu with the specified default selection.
 
Method Summary
protected  Menu.MenuBrowseList createBrowseList(Vector items, BrowseList.Title title)
          Creates our own implementation of a browse list.
static Menu createOnOffMenu(boolean flag, Display display)
          A convenience method that creates a radio menu containing "Off" and "On".
 int getSelectedIndex()
          Gets the index of the currently selected item.
static void setDefaultNotSelectedImage(String image)
          Sets the default image for an item that is not selected.
static void setDefaultSelectedImage(String image)
          Sets the default image for a selected item.
 void setJumpToSelected(boolean flag)
          Indicates whether the menu should jump to the currently selected item when it is activated.
 void setNotSelectedImage(String image)
          Sets the image to use for an item that is not selected.
 void setSelectedImage(String image)
          Sets the image to use for a selected item.
 void setSelectedIndex(int index)
          Sets the index of the currently selected item.
 
Methods inherited from class com.livescribe.ext.ui.Menu
add, add, add, add, addAction, addMenuListener, doSelect, fireItemChanged, fireItemSelected, fireMenuShown, getBrowseList, getFocusIndex, getItemCount, getMetadata, getMetadata, getParent, getSubmenu, handleMenuEvent, isSelectable, remove, removeMenuListener, setAudio, setBackAPM, setBookmarkable, setDefaultBackAPM, setDefaultForwardAPM, setDefaultSelectAPM, setFocusIndex, setForwardAPM, setIcon, setLastItemBookmarkable, setMetadata, setMetadata, setOneWayParent, setPlayBackAPM, setPlayForwardAPM, setPlaySelectAPM, setSelectable, setSelectAPM, setSubmenu, setText, show, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RadioMenu

public RadioMenu(String[] text,
                 int selectedIndex,
                 Display display)
Creates a new menu with the specified default selection.

Parameters:
text - the menu items
selectedIndex - the initial selection
display - the display object
Throws:
IndexOutOfBoundsException - if the selected index is out of range.
Method Detail

createOnOffMenu

public static Menu createOnOffMenu(boolean flag,
                                   Display display)
A convenience method that creates a radio menu containing "Off" and "On".

Parameters:
flag - the initial selection, true for "On" and false for "Off"
display - the display object
Returns:
a new On/Off radio menu.

createBrowseList

protected Menu.MenuBrowseList createBrowseList(Vector items,
                                               BrowseList.Title title)
Creates our own implementation of a browse list.

Overrides:
createBrowseList in class Menu
Parameters:
items - the items
title - the title
Returns:
a new browse list implementation.

setDefaultSelectedImage

public static void setDefaultSelectedImage(String image)
Sets the default image for a selected item. This is set to null by default.

Parameters:
image - the new default selected image, null to unset

setDefaultNotSelectedImage

public static void setDefaultNotSelectedImage(String image)
Sets the default image for an item that is not selected. This is set to null by default.

Parameters:
image - the new default not selected image, null to unset

setSelectedImage

public void setSelectedImage(String image)
Sets the image to use for a selected item. This overrides the default image. If this is set to null then the default image will be used. This is set to null by default.

Parameters:
image - the new selected image, null to unset
See Also:
setDefaultSelectedImage(String)

setNotSelectedImage

public void setNotSelectedImage(String image)
Sets the image to use for an item that is not selected. This overrides the default image. If this is set to null then the default image will be used. This is set to null by default.

Parameters:
image - the new not selected image, null to unset
See Also:
setDefaultNotSelectedImage(String)

getSelectedIndex

public int getSelectedIndex()
Gets the index of the currently selected item.

Returns:
the selected item index.

setJumpToSelected

public void setJumpToSelected(boolean flag)
Indicates whether the menu should jump to the currently selected item when it is activated. The default is true.

Parameters:
flag - the new state

setSelectedIndex

public void setSelectedIndex(int index)
Sets the index of the currently selected item. This also swaps the images, so be sure to redisplay the browse list.

Parameters:
index - the new selected item index
Throws:
IndexOutOfBoundsException - if the index is out of range.
See Also:
Menu.getItemCount()

PenProfile 2.x

Copyright © 2010 Livescribe Inc. All Rights Reserved.
Confidential and subject to NDA.