|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--GMenu
This class allows a programmer to build a general purpose main menu for the text-based screen console (see Console). In normal usage, the programmer adds a menu title and up to 14 menu items that will be displayed by the displayMenu() method.
Field Summary | |
static int |
ITEM_COL
Default column number where selection items will print. |
static int |
MAX_ITEMS
Maximum size of menu with one title and 14 selection items. |
static int |
MENU_TITLE_OFFSET
Default offset from the item column, where the title will print. |
static int |
MENU_TITLE_ROW
Default row number where menu title will print. |
Constructor Summary | |
GMenu()
Initializes the menu object. |
|
GMenu(int itemCol,
int menuTitleRow,
int menuTitleOffset,
int menuStartRow)
Initializes the menu object with non-default format parameters. |
Method Summary | |
int |
addMenuItem(java.lang.String menuItem)
Adds a menuItem to the menu. |
int |
addTitle(java.lang.String title)
Adds a title to the menu object. |
void |
displayMenu(Console con)
Constructs the menu in the con screen and displays it on the display device |
int |
getItemCol()
Returns the value of the column where selection items will be printed. |
int |
getMenuStartRow()
Returns the row number where the first menu selection item will print. |
int |
getMenuTitleOffset()
Returns the value of the column offset (from item column) which determines from which column the title will start printing. |
int |
getMenuTitleRow()
Returns the value of the row number where the menu title will be printed. |
void |
setItemCol(int col)
Sets the column where selection items will be printed on the screen. |
void |
setMenuStartRow(int row)
Sets the row number where the first menu selection item will print. |
void |
setMenuTitleOffset(int off)
Sets the offset used to determine the column number where the menu title will be printed. |
void |
setMenuTitleRow(int row)
Sets the row number where the menu title will be printed. |
java.lang.String |
toString()
Overrides Object.toString() method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int MAX_ITEMS
public static final int ITEM_COL
public static final int MENU_TITLE_ROW
public static final int MENU_TITLE_OFFSET
Constructor Detail |
public GMenu()
public GMenu(int itemCol, int menuTitleRow, int menuTitleOffset, int menuStartRow)
itemCol is the screen column where an item will start.
menuTitleRow is the row number for the title
menuTitleOffset is an offset that determines how far to the right
or left of the itemCol the title will print.
menuStartRow is the row where the menu selection items start
itemCol should be between 0 and 50 or the value will be set to the default, ITEM_COL.
menuTitleRow should be between 0 and 12 or the value will be set to the default, MENU_TITLE_ROW.
menuTitleOffset may be negative or positive but should not result in the start column of the title from exceeding the same bounds as the itemCol constraints, otherwise the value will be the default, MENU_TITLE_OFFSET.
menuStartRow should be between 1 and 23 or the value will be set to the default, MENU_START_ROW.
Method Detail |
public void setItemCol(int col)
public void setMenuTitleRow(int row)
public void setMenuTitleOffset(int off)
public void setMenuStartRow(int row)
public int getItemCol()
public int getMenuTitleRow()
public int getMenuTitleOffset()
public int getMenuStartRow()
public int addMenuItem(java.lang.String menuItem)
Menu items should be added in the order they are to appear on the screen.
public int addTitle(java.lang.String title)
public void displayMenu(Console con)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |