|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--MenuWindow
A MenuWindow implements a programmerspecifiable menu window. The window
contains of a number of buttons, one for each menu alternative specified
by the application program. When the user clicks on one of the buttons,
the menuItemSelected
method is automatically called.
The intention is that the MenuWindow class should be used as a super
class to another class which overloads the menuItemSelcted
method. The overloaded method should contain the Java code to be executed
when a menu item is selected.
Another possible way of using the class is to modify the MenuWindow class
directly, putting the code to be executed when a new message is entered
directly in the menuItemSelected
method.
Constructor Summary | |
MenuWindow(int x,
int y,
java.lang.String title)
Creates an empty MenuWindow containing no menu items. |
Method Summary | |
void |
add(java.lang.String menuItem)
Adds a new menu item to the bottom of the menu. |
void |
clear()
Clears the menu from all menu items. |
void |
destroy()
Destroys the MenuWindow and frees all resources associated with it. |
void |
hide()
Makes the MenuWindow invisible. |
void |
menuItemSelected(java.lang.String menuItem,
int position)
The menuItemSelected method is called whenever the user
clicks on one of the buttons in the menu window. |
void |
show()
Makes the MenuWindow visible. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MenuWindow(int x, int y, java.lang.String title)
show
method in order to display the window.Note: Depending on which window manager/window system you use, both window title and position might be ignored.
x
- the x coordinate of the position of the windowy
- the y coordinate of the position of the windowtitle
- a String containing the title to be displayed in
the title bar of the windowMethod Detail |
public void clear()
public void add(java.lang.String menuItem)
menuItem
- A string containing the text to be displayed
for this menu item.public void destroy()
destroy
method should be called when the MenuWindow
is not needed anymore. Note that it is ILLEGAL to call any
method of the MenuWindow object once destroy
has
been called.
public void hide()
show
to make the
window visible again.
show()
public void show()
show
method. Call hide
to make the
window invisible again.
hide()
public void menuItemSelected(java.lang.String menuItem, int position)
menuItemSelected
method is called whenever the user
clicks on one of the buttons in the menu window.
The intention is that this method should be overloaded in a
subclass to MenuWindow. The default implementation found in the
MenuWindow class does nothing.
menuItem
- a string containing the text on the selected buttonposition
- the position of the button within the menu. The
first button is numbered 0.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |