Class tea.set.ListText
All Packages Class Hierarchy This Package Previous Next Index
Class tea.set.ListText
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----tea.set.Cell
|
+----tea.set.ListText
- public class ListText
- extends Cell
- implements TextEdit
ListText is a list based text edit widget. A list of words are
associated with each ListText. When an user types in the ListText,
ListText automatically searchs for the best match from the
list. There are options to make the search case sensitive or
otherwise. Users can also specify if only words from the list
are allowed by calling setForce(). This method should be called
after all addItem() methods are done if ListText is initialized
to a default text value. Because setForce will do
an immediate check to see if the current value is on the list,
an error message will be issued if the current value is not
empty and it's not on the list.
When an item is selected from the list window,
a LIST_SELECT event is triggered with this(ListText) as the target,
and the selected item(String) as arg.
ListText itself does not draw a border around the text area. Use
Effect3D to add a border if desired:
add(new Effect3D(new ListText(cols), Effect3D.LOWERED));
Known bug: In JDK 1.0.1, On Win32 architectures, the coordinate (x,
y) is relative to the current component. On XWindow, the coordinate
(x, y) is relative to the window manager screen.
In JDK 1.0.2, all coordinate is relative to the screen. Therefore,
this version assumes the 1.0.2 semantics. It may not work with
browsers with 1.0.1 equivalent Java VM. Netscape 3.0 has yet another
interpretation of the window location. We try to use JDK 1.0.2 as
the standard.
If a TextList widget is used
inside a dialog, the list window will be covered by the dialog.
There is no obvious way to disable dialog from always shown on
top of list window. Therefore, if you need to popup a subwindow, use
Frame instead.
- See Also:
- TextEdit
-
ListText(int)
- Construct a ListText with cols columns.
-
ListText(String)
- Construct a ListText with str as the initial value.
-
ListText(String, int)
- Construct a ListText with str as the initial value and cols
columns.
-
action(Event, Object)
- Action event ('\r', '\t') causes the list window to disappear.
-
addItem(String)
- Add an item to the list.
-
delItem(String)
- Delete an item from the list.
-
finalize()
- Popdown the list window.
-
keyDown(Event, int)
- KeyDown event.
-
mouseDown(Event, int, int)
- Handle mouse down event.
-
popdown()
- Close the list window.
-
popup()
- Popup a new list window.
-
setCaseSensitive(boolean)
- Set case sensitive to true or false.
-
setForce(boolean)
- Set force option to true of false.
ListText
public ListText(int cols)
- Construct a ListText with cols columns.
- Parameters:
- cols - number of columns.
ListText
public ListText(String str)
- Construct a ListText with str as the initial value.
- Parameters:
- str - initial text.
ListText
public ListText(String str,
int cols)
- Construct a ListText with str as the initial value and cols
columns.
- Parameters:
- str - initial text.
- cols - number of columns.
setCaseSensitive
public void setCaseSensitive(boolean t)
- Set case sensitive to true or false.
- Parameters:
- t - case sensitivity.
setForce
public void setForce(boolean t)
- Set force option to true of false. If force option is true, only
the words from the list are allowed in the text edit.
- Parameters:
- t - force mode.
addItem
public void addItem(String item)
- Add an item to the list.
- Parameters:
- item - list item string.
delItem
public void delItem(String item)
- Delete an item from the list.
- Parameters:
- item - list item string.
action
public boolean action(Event e,
Object arg)
- Action event ('\r', '\t') causes the list window to disappear.
- Parameters:
- e - event object.
- arg - event argument object.
- Overrides:
- action in class Component
mouseDown
public boolean mouseDown(Event e,
int x,
int y)
- Handle mouse down event.
- Overrides:
- mouseDown in class Cell
keyDown
public boolean keyDown(Event e,
int key)
- KeyDown event. A key event causes the list to popup if it's not
already up.
- Parameters:
- e - event object.
- key - key pressed.
- Overrides:
- keyDown in class Cell
popup
public void popup()
- Popup a new list window.
popdown
public void popdown()
- Close the list window.
finalize
public void finalize()
- Popdown the list window.
- Overrides:
- finalize in class Object
All Packages Class Hierarchy This Package Previous Next Index