Class tea.set.TextCell
All Packages Class Hierarchy This Package Previous Next Index
Class tea.set.TextCell
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----tea.set.TextCell
- public class TextCell
- extends Panel
- implements TextEdit
TextCell handle displaying and editing of text. It automatically
detects multi-line text and set size accordingly. If TextCell is
editable and it's a single line text, tea.set.Cell is used for
editing. If it's a multi-line text, java.awt.TextArea is used
for editing.
- See Also:
- TextEdit, Cell
-
TextCell(int, int, boolean)
- Construct a TextCell.
-
TextCell(String, boolean)
- Construct a TextCell.
-
appendText(String)
- Append text to the end.
-
clearSelection()
- Clear selection.
-
getColumns()
- Get number of columns.
-
getCursorPos()
- Get cursor position.
-
getGridCol()
- Return the grid column number.
-
getGridRow()
- Return the grid row number.
-
getSelectedText()
- Return selected (highlighted) text.
-
getSelectionEnd()
- Get the end position of selection.
-
getSelectionStart()
- Get the starting position of selection.
-
getText()
- Get text value.
-
handleEvent(Event)
- Switch to edit mode at mouse click.
-
insertText(String, int)
- Insert text at the position.
-
isEditable()
- Return true if editable (default).
-
removeText(int, int)
- Remove text in the range.
-
select(int, int)
- Select the text in the range.
-
selectAll()
- Select all text.
-
setCursorPos(int)
- Set cursor at position.
-
setEditable(boolean)
- Set editable to true of false.
-
setEditMode(boolean)
- Switch to editing mode if true, to displaying mode if false.
-
setGrid(int, int)
- Set the grid row and column.
-
setInsertMode(boolean)
- Set insertion mode to true or false (overwrite).
-
setText(String)
- Set the value of text.
TextCell
public TextCell(int r,
int c,
boolean editable)
- Construct a TextCell. The initial state is display only. It
switches to edit mode at mouse click.
- Parameters:
- r - number of rows.
- c - number of columns.
- editable - cell editable flag.
TextCell
public TextCell(String text,
boolean editable)
- Construct a TextCell. The numbers of rows and columns are
calculated using the string parameter. The initial state
is display only. It switchs to edit mode at mouse click.
- Parameters:
- text - initial text.
- editable - cell editable flag.
setGrid
public void setGrid(int row,
int col)
- Set the grid row and column.
getGridRow
public int getGridRow()
- Return the grid row number.
- Returns:
- row number in a grid.
getGridCol
public int getGridCol()
- Return the grid column number.
- Returns:
- column number in a grid.
handleEvent
public boolean handleEvent(Event e)
- Switch to edit mode at mouse click.
- Parameters:
- e - event object.
- Overrides:
- handleEvent in class Component
setEditMode
public void setEditMode(boolean t)
- Switch to editing mode if true, to displaying mode if false.
- Parameters:
- t - edit mode flag.
setInsertMode
public void setInsertMode(boolean mode)
- Set insertion mode to true or false (overwrite).
- Parameters:
- true - for insert mode and false for overwrite mode.
setText
public void setText(String t)
- Set the value of text.
- Parameters:
- t - cell text.
getText
public String getText()
- Get 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.
getColumns
public int getColumns()
- Get number of columns.
- Returns:
- number of columns in cell.
appendText
public void appendText(String str)
- Append text to the end.
- Parameters:
- str - text to append to cell.
insertText
public void insertText(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.
removeText
public void removeText(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