All Packages Class Hierarchy This Package Previous Next Index
Class tea.set.ComboBox
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----tea.set.ComboBox
- public class ComboBox
- extends Panel
- implements TextEdit, ItemSelectable
ComboBox is a text edit widget that supports selecting text item
from a dropdown menu, in addition to inline editing. When the dropdown
menu is popped up, user typed text will be used to find the best
match in the list and scrolled up to the top. Users can be restricted
to enter text only on the item list, or any text.
ComboBox supports the following properties:
Property Name | Property Type | Description |
CaseSensitive | boolean |
True if case sensitive when match text. |
Force | boolean |
True if user only allowed to enter text in the item list. |
SelectedObjects | Object[] (Readonly) |
list of selected items in the item list.
|
InsertMode | boolean |
True for insert mode, and false for overwrite mode. |
Text | String |
Text in the cell. |
SelectedText | String (Readonly) |
Selected (highlighted) Text in the cell. |
Editable | boolean |
Allow editing or not. |
SelectionStart | int (Readonly) |
Starting index of selected text. |
SelectionEnd | int (Readonly) |
End index of selected text. |
Columns | int |
Text columns in the cell. |
CursorPos | int |
Cursor position in the cell. |
ComboBox generates the following events:
Event Type | Event ID | Generated |
Description |
ActionEvent | ActionEvent.ACTION_PERFORMED |
Return or Tab key, or text changed through setText(). |
ActionEvent.getActionCommand() contains the text. |
ItemEvent | ItemEvent.SELECTED |
Item selected from list. |
ItemEvent.getItem() contains the selected item, and
ItemEvent.getStateChange() is 0. |
TextEvent | TextEvent.TEXT_VALUE_CHANGED |
Text changed by user. |
Generated for every key stroke. |
- See Also:
- TextEdit, ListText
-
eventMgr
- EventMgr object handles added event processing and dispatching.
-
ComboBox()
- Construct a new ComboBox, the initial size is 0.
-
ComboBox(int)
- Construct a ComboBox with the specified number of columns.
-
ComboBox(String)
- Construct a ComboBox with the string as the initial text and the
string length as the size.
-
ComboBox(String, int)
-
Construct a ComboBox with the string as the initial text and
the specified num as the size.
-
add(String)
- Add an item to the item list.
-
addActionListener(ActionListener)
- Add an action listener.
-
addItemListener(ItemListener)
- Add an item listener.
-
addTextListener(TextListener)
- Add an text listener.
-
append(String)
- Append text to the end.
-
clearSelection()
- Clear selection.
-
getColumns()
- Returns the number of columns in this TextEdit.
-
getCursorPos()
- Get cursor position.
-
getSelectedObjects()
- Get the items selected in the item list.
-
getSelectedText()
- Return selected (highlighted) text.
-
getSelectionEnd()
- Get the end position of selection.
-
getSelectionStart()
- Get the starting position of selection.
-
getText()
- Get current text value.
-
insert(String, int)
- Insert text at the position.
-
isCaseSensitive()
- Get case sensitive setting.
-
isEditable()
- Return true if editable (default).
-
isForce()
- Get the force option flag.
-
isInsertMode()
- Get the insertion mode flag.
-
popdown()
- Close the item list window.
-
popup()
- Drop down the item list menu.
-
processActionEvent(ActionEvent)
- Process and dispatch action event.
-
processEvent(AWTEvent)
- Process and dispatch event.
-
processItemEvent(ItemEvent)
- Process and dispatch item event.
-
processTextEvent(TextEvent)
- Process and dispatch text event.
-
remove(int, int)
- Remove text in the range.
-
remove(String)
- Delete an item from the list.
-
removeActionListener(ActionListener)
- Remove an action listener.
-
removeAll()
- Delete all items from the list.
-
removeItemListener(ItemListener)
- Remove an item listener.
-
removeTextListener(TextListener)
- Remove an text listener.
-
select(int, int)
- Select the text in the range.
-
selectAll()
- Select all text.
-
setCaseSensitive(boolean)
- Set case sensitive to true or false.
-
setColumns(int)
- Sets the number of columns in this TextEdit.
-
setCursorPos(int)
- Set cursor at position.
-
setEditable(boolean)
- Set editable to true of false.
-
setForce(boolean)
- Set force option to true of false.
-
setInsertMode(boolean)
- Set insertion mode to true or false (overwrite).
-
setText(String)
- Set the value of text.
eventMgr
protected EventMgr eventMgr
- EventMgr object handles added event processing and dispatching.
ComboBox
public ComboBox()
- Construct a new ComboBox, the initial size is 0. Use setColunms()
to change the size.
ComboBox
public ComboBox(int cols)
- Construct a ComboBox with the specified number of columns.
- Parameters:
- cols - number of columns.
ComboBox
public ComboBox(String str)
- Construct a ComboBox with the string as the initial text and the
string length as the size.
- Parameters:
- str - initial string.
ComboBox
public ComboBox(String str,
int cols)
- Construct a ComboBox with the string as the initial text and
the specified num as the size.
- Parameters:
- str - initial string.
- cols - number of columns.
getColumns
public int getColumns()
- Returns the number of columns in this TextEdit.
setColumns
public void setColumns(int columns)
- Sets the number of columns in this TextEdit.
- Parameters:
- columns - the number of columns
setCaseSensitive
public synchronized void setCaseSensitive(boolean t)
- Set case sensitive to true or false.
- Parameters:
- t - case sensitivity.
isCaseSensitive
public boolean isCaseSensitive()
- Get case sensitive setting.
- Returns:
- true if case is sensitive.
setForce
public synchronized 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.
isForce
public boolean isForce()
- Get the force option flag.
- Returns:
- true if ListText is in force mode.
add
public synchronized void add(String item)
- Add an item to the item list.
- Parameters:
- item - item string.
remove
public synchronized void remove(String item)
- Delete an item from the list.
- Parameters:
- item - item string.
removeAll
public synchronized void removeAll()
- Delete all items from the list.
- Overrides:
- removeAll in class Container
addItemListener
public void addItemListener(ItemListener listener)
- Add an item listener.
- Parameters:
- listener - item listener.
removeItemListener
public void removeItemListener(ItemListener listener)
- Remove an item listener.
- Parameters:
- listener - item listener.
addActionListener
public void addActionListener(ActionListener listener)
- Add an action listener.
- Parameters:
- listener - action listener.
removeActionListener
public void removeActionListener(ActionListener listener)
- Remove an action listener.
- Parameters:
- listener - action listener.
addTextListener
public void addTextListener(TextListener listener)
- Add an text listener.
- Parameters:
- listener - text listener.
removeTextListener
public void removeTextListener(TextListener listener)
- Remove an text listener.
- Parameters:
- listener - text listener.
processItemEvent
public void processItemEvent(ItemEvent e)
- Process and dispatch item event.
- Parameters:
- e - item event.
processActionEvent
public void processActionEvent(ActionEvent e)
- Process and dispatch action event.
- Parameters:
- e - action event.
processTextEvent
public void processTextEvent(TextEvent e)
- Process and dispatch text event.
- Parameters:
- e - text event.
processEvent
public void processEvent(AWTEvent e)
- Process and dispatch event.
- Parameters:
- e - event object.
- Overrides:
- processEvent in class Container
popup
public synchronized void popup()
- Drop down the item list menu.
popdown
public synchronized void popdown()
- Close the item list window.
getSelectedObjects
public Object[] getSelectedObjects()
- Get the items selected in the item list.
- Returns:
- selected item list.
setInsertMode
public void setInsertMode(boolean mode)
- Set insertion mode to true or false (overwrite).
- Parameters:
- true - for insert mode and false for overwrite mode.
isInsertMode
public boolean isInsertMode()
- Get the insertion mode flag.
- Returns:
- true if it is in insert mode.
setText
public void setText(String t)
- Set the value of text.
- Parameters:
- t - cell text.
getText
public String getText()
- Get current text value.
- Returns:
- cell text.
getSelectedText
public String getSelectedText()
- Return selected (highlighted) text.
- Returns:
- selected text.
isEditable
public boolean isEditable()
- Return true if editable (default).
- Returns:
- true if cell is editable.
setEditable
public void setEditable(boolean t)
- Set editable to true of false.
- Parameters:
- t - cell editable to true or false.
getSelectionStart
public int getSelectionStart()
- Get the starting position of selection.
- Returns:
- starting position of selected text.
getSelectionEnd
public int getSelectionEnd()
- Get the end position of selection.
- Returns:
- ending position of selected text.
select
public void select(int selStart,
int selEnd)
- Select the text in the range.
- Parameters:
- selStart - starting position of selection.
- selEnd - ending position of selection.
selectAll
public void selectAll()
- Select all text.
clearSelection
public void clearSelection()
- Clear selection.
append
public void append(String str)
- Append text to the end.
- Parameters:
- str - text to append to cell.
insert
public void insert(String str,
int pos)
- Insert text at the position.
- Parameters:
- str - text to insert.
- pos - insertion position.
setCursorPos
public void setCursorPos(int pos)
- Set cursor at position.
- Parameters:
- pos - cursor position.
getCursorPos
public int getCursorPos()
- Get cursor position.
- Returns:
- cursor position.
remove
public void remove(int start,
int end)
- Remove text in the range.
- Parameters:
- start - starting position of text to remove.
- end - ending position of text to remove.
All Packages Class Hierarchy This Package Previous Next Index