|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ListWindow
A ListWindow is a window which presents a list of strings and lets the user
select one of them. The ListWindow can for example be used for presenting
a list of chat participants and selecting one participant might be used
to indicate that a private chat should be initiated. Input, that is
selecting a string in the list, is handled by
the elementSelected
method which is called automatically
whenever the user selects an item in the list. The intention is that the
ListWindow class should be used as a super class to another class which
overloads the elementSelected
method. The overloaded method
should contain the Java code to be executed, if any, when an element is
selected. It is also possible to ask the ListWindow at any time which
element is currently selected.
Another possible way of using the class is to modify the ListWindow class
directly, putting the code to be executed when a new message is entered
directly in the elementSelected
method.
Constructor Summary | |
ListWindow(int x,
int y,
java.lang.String title)
Constructs a ListWindow at a given position on the screen and with a given title which is displayed in the title bar of the window. |
Method Summary | |
void |
add(java.lang.String element)
Adds a new element to the end of the list presented in the ListWindow. |
void |
clear()
Clears the contents of the ListWindow and removes all elements in the list. |
void |
destroy()
Destroys the ListWindow and frees all resources associated with it. |
void |
elementSelected(java.lang.String element,
int position)
Returns the text associated with the currently selected item. |
int |
getSelectedPosition()
Returns the index of the currently selected item, if any, in the list. |
void |
hide()
Makes the ListWindow invisible. |
void |
show()
Makes the ListWindow visible. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ListWindow(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 add(java.lang.String element)
element
- a string containing the text which is to be displayed
in the ListWindowpublic void clear()
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 destroy()
destroy
method should be called when the ListWindow
is not needed anymore. Note that it is ILLEGAL to call any
method of the ListWindow object once destroy
has
been called.
public int getSelectedPosition()
public void elementSelected(java.lang.String element, int position)
element
- a String containing the text of the selected elementposition
- the index of the selected element
elementSelected
method is called whenever the user
selects an element in the ListWindow.
The intention is that this method should be overloaded in a
subclass to ListWindow. The default implementation found in the
ListWindow class does nothing.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |