|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectCanvas
Menu
public class Menu
The Menu class represents a menu that displays items in columns.
The constructors compute automatically the preferred number of columns
(see getPreferredNumberOfColumns()
), but this value can be changed using the
setNbCol(int nbCol)
method. The fitsOnScreen()
method
is used to check whether all the items fit on the screen.
Constructor Summary | |
---|---|
Menu(java.lang.String[] items,
java.lang.String[] itemsFull,
boolean bold,
java.lang.String title,
MenuListener listener)
Constructs a menu with the given items. |
|
Menu(java.lang.String[] items,
java.lang.String[] itemsFull,
MenuListener listener)
This constructor is a shortcut for the other constructor using bold = false
and title = null . |
Method Summary | |
---|---|
boolean |
fitsOnScreen()
Returns whether the items fit on the screen. |
int |
getMaxNumberOfColumns()
Computes the maximum number of columns, according to the current device and the values specified in the constructor. |
int |
getPreferredNumberOfColumns()
Computes the preferred number of columns, according to the current device and the values specified in the constructor. |
void |
paint(Graphics g)
|
void |
setNbCol(int nbCol)
Sets the number of columns of the menu. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Menu(java.lang.String[] items, java.lang.String[] itemsFull, boolean bold, java.lang.String title, MenuListener listener)
getPreferredNumberOfColumns()
method.
items
- the items to show in the menuitemsFull
- the full names of the items. These names are displayed on
the top of the menu when the corresponding item is selected. This value
can be null
bold
- determines whether the current selected item must be displayed
in boldtitle
- the title of this menu, or null
if there is no
titlelistener
- the listener to fire when an item is selectedgetPreferredNumberOfColumns()
public Menu(java.lang.String[] items, java.lang.String[] itemsFull, MenuListener listener)
bold = false
and title = null
.
Menu(String[], String[], boolean, String, MenuListener)
Method Detail |
---|
public void setNbCol(int nbCol)
getPreferredNumberOfColumns()
method is used to determine
the number of columns.
nbCol
- the number of columns, or 0 to compute automatically this
numbergetPreferredNumberOfColumns()
public int getMaxNumberOfColumns()
public int getPreferredNumberOfColumns()
public boolean fitsOnScreen()
true
if the items fit on the screen, otherwise false
public void paint(Graphics g)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |