lejos.nxt
Class TextMenu

java.lang.Object
  extended by lejos.nxt.TextMenu

public class TextMenu
extends Object

Displays a list of items. The select() method allows the user to scroll the list using the right and left keys to scroll forward and backward through the list. The number maximum number of rows, and an optional title can be specified.

Author:
Roger Glassey Feb 20, 2007

Field Summary
static String blank
          a blank line
 
Constructor Summary
TextMenu(String[] items)
          This constructor sets the menu size to 8 rows, the top linw is in display row 0
TextMenu(String[] items, int size, int topRow)
          This constructor allows specification of the size and top row of the menu.
TextMenu(String[] items, int size, String title)
          This constuctor allows the specfication of a title (of up to 16 characters) displayed in row 0, and the size of the menu.
 
Method Summary
 int select()
          Allows the to scroll through the items, using the right and left buttons.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Field Detail

blank

public static String blank
a blank line

Constructor Detail

TextMenu

public TextMenu(String[] items)
This constructor sets the menu size to 8 rows, the top linw is in display row 0


TextMenu

public TextMenu(String[] items,
                int size,
                int topRow)
This constructor allows specification of the size and top row of the menu.


TextMenu

public TextMenu(String[] items,
                int size,
                String title)
This constuctor allows the specfication of a title (of up to 16 characters) displayed in row 0, and the size of the menu.
The top row of the menu itself is row 1 of the display

Parameters:
items - - string array containing the menu items. Null strings will produce a blank line in the display.
Method Detail

select

public int select()
Allows the to scroll through the items, using the right and left buttons. The Enter key closes the menu
and returns the index of the selected item.
The menu display wraps items that scroll off the top will reappear on the bottom and vice versa.

Returns:
the index of the selected item