|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.swt.widgets.Widget | +--org.eclipse.swt.widgets.Control | +--org.eclipse.swt.widgets.Scrollable | +--org.eclipse.swt.widgets.Text
Safe: Instances of this class are selectable user interface objects that allow the user to enter and modify text.
Note: Only one of the styles MULTI and SINGLE may be specified.
IMPORTANT: This class is not intended to be subclassed.
Field Summary | |
static String |
DELIMITER
Enabled: |
(package private) boolean |
doubleClick
|
(package private) static org.eclipse.swt.internal.win32.TCHAR |
EditClass
|
(package private) static int |
EditProc
|
(package private) boolean |
ignoreCharacter
|
(package private) boolean |
ignoreVerify
|
static int |
LIMIT
Enabled: |
(package private) int |
oldEnd
|
(package private) int |
oldStart
|
(package private) int |
tabs
|
Fields inherited from class org.eclipse.swt.widgets.Scrollable |
horizontalBar, verticalBar |
Fields inherited from class org.eclipse.swt.widgets.Control |
ACCENTS, accessible, background, drawCount, foreground, handle, hCursor, layoutData, menu, parent, toolTipText |
Fields inherited from class org.eclipse.swt.widgets.Widget |
CANVAS, COMCTL32_MAJOR, COMCTL32_MINOR, data, DEFAULT_HEIGHT, DEFAULT_WIDTH, DISABLED, DISPOSED, eventTable, HIDDEN, keys, MAJOR, MINOR, Mnemonic, state, style, values |
Constructor Summary | |
Text(Composite parent,
int style)
Enabled: Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. |
Method Summary | |
void |
addModifyListener(ModifyListener listener)
Enabled: Adds the listener to the collection of listeners who will be notified when the receiver's text is modified, by sending it one of the messages defined in the ModifyListener
interface. |
void |
addSelectionListener(SelectionListener listener)
Enabled: Adds the listener to the collection of listeners who will be notified when the control is selected, by sending it one of the messages defined in the SelectionListener
interface. |
void |
addVerifyListener(VerifyListener listener)
Enabled: Adds the listener to the collection of listeners who will be notified when the receiver's text is verified, by sending it one of the messages defined in the VerifyListener
interface. |
void |
append(String string)
Enabled: Appends a string. |
(package private) int |
callWindowProc(int msg,
int wParam,
int lParam)
|
(package private) static int |
checkStyle(int style)
|
void |
clearSelection()
Enabled: Clears the selection. |
Point |
computeSize(int wHint,
int hHint,
boolean changed)
Enabled: |
void |
copy()
Suppressed: Copies the selected text. |
(package private) void |
createHandle()
|
(package private) void |
createWidget()
|
void |
cut()
Suppressed: Cuts the selected text. |
(package private) int |
defaultBackground()
|
int |
getCaretLineNumber()
Enabled: Gets the line number of the caret. |
Point |
getCaretLocation()
Enabled: Gets the location the caret. |
int |
getCaretPosition()
Enabled: Gets the position of the caret. |
int |
getCharCount()
Enabled: Gets the number of characters. |
(package private) String |
getClipboardText()
|
boolean |
getDoubleClickEnabled()
Enabled: Gets the double click enabled flag. |
char |
getEchoChar()
Enabled: Gets the echo character. |
boolean |
getEditable()
Enabled: Gets the editable state. |
int |
getLineCount()
Enabled: Gets the number of lines. |
String |
getLineDelimiter()
Enabled: Gets the line delimiter. |
int |
getLineHeight()
Enabled: Gets the height of a line. |
Point |
getSelection()
Enabled: Gets the position of the selected text. |
int |
getSelectionCount()
Enabled: Gets the number of selected characters. |
String |
getSelectionText()
Enabled: Gets the selected text. |
int |
getTabs()
Enabled: Gets the number of tabs. |
(package private) int |
getTabWidth(int tabs)
|
String |
getText()
Enabled: Gets the widget text. |
String |
getText(int start,
int end)
Enabled: Gets a range of text. |
int |
getTextLimit()
Enabled: Returns the maximum number of characters that the receiver is capable of holding. |
int |
getTopIndex()
Enabled: Returns the zero-relative index of the line which is currently at the top of the receiver. |
int |
getTopPixel()
Enabled: Gets the top pixel. |
void |
insert(String string)
Enabled: Inserts a string. |
(package private) int |
mbcsToWcsPos(int mbcsPos)
|
void |
paste()
Suppressed: Pastes text from clipboard. |
void |
removeModifyListener(ModifyListener listener)
Enabled: Removes the listener from the collection of listeners who will be notified when the receiver's text is modified. |
void |
removeSelectionListener(SelectionListener listener)
Enabled: Removes the listener from the collection of listeners who will be notified when the control is selected. |
void |
removeVerifyListener(VerifyListener listener)
Enabled: Removes the listener from the collection of listeners who will be notified when the control is verified. |
void |
selectAll()
Enabled: Selects all the text in the receiver. |
(package private) boolean |
sendKeyEvent(int type,
int msg,
int wParam,
int lParam,
Event event)
|
(package private) void |
setBounds(int x,
int y,
int width,
int height,
int flags)
|
void |
setDoubleClickEnabled(boolean doubleClick)
Enabled: Sets the double click enabled flag. |
void |
setEchoChar(char echo)
Enabled: Sets the echo character. |
void |
setEditable(boolean editable)
Enabled: Sets the editable state. |
void |
setFont(Font font)
Enabled: |
void |
setRedraw(boolean redraw)
Enabled: |
void |
setSelection(int start)
Enabled: Sets the selection. |
void |
setSelection(int start,
int end)
Enabled: Sets the selection. |
void |
setSelection(Point selection)
Enabled: Sets the selection. |
void |
setTabs(int tabs)
Enabled: Sets the number of tabs. |
(package private) void |
setTabStops(int tabs)
|
void |
setText(String string)
Enabled: Sets the contents of the receiver to the given string. |
void |
setTextLimit(int limit)
Enabled: Sets the maximum number of characters that the receiver is capable of holding to be the argument. |
void |
setTopIndex(int index)
Enabled: Sets the zero-relative index of the line which is currently at the top of the receiver. |
void |
showSelection()
Enabled: Shows the selection. |
(package private) String |
verifyText(String string,
int start,
int end)
|
(package private) String |
verifyText(String string,
int start,
int end,
Event keyEvent)
|
(package private) int |
wcsToMbcsPos(int wcsPos)
|
(package private) int |
widgetStyle()
|
(package private) org.eclipse.swt.internal.win32.TCHAR |
windowClass()
|
(package private) int |
windowProc()
|
(package private) org.eclipse.swt.internal.win32.LRESULT |
WM_CHAR(int wParam,
int lParam)
|
(package private) org.eclipse.swt.internal.win32.LRESULT |
WM_CLEAR(int wParam,
int lParam)
|
(package private) org.eclipse.swt.internal.win32.LRESULT |
WM_CUT(int wParam,
int lParam)
|
(package private) org.eclipse.swt.internal.win32.LRESULT |
WM_GETDLGCODE(int wParam,
int lParam)
|
(package private) org.eclipse.swt.internal.win32.LRESULT |
WM_IME_CHAR(int wParam,
int lParam)
|
(package private) org.eclipse.swt.internal.win32.LRESULT |
WM_LBUTTONDBLCLK(int wParam,
int lParam)
|
(package private) org.eclipse.swt.internal.win32.LRESULT |
WM_PASTE(int wParam,
int lParam)
|
(package private) org.eclipse.swt.internal.win32.LRESULT |
WM_UNDO(int wParam,
int lParam)
|
(package private) org.eclipse.swt.internal.win32.LRESULT |
wmCommandChild(int wParam,
int lParam)
|
Methods inherited from class org.eclipse.swt.widgets.Scrollable |
computeTrim, createScrollBar, getClientArea, getHorizontalBar, getVerticalBar, releaseWidget, widgetExtStyle, WM_HSCROLL, WM_MOUSEWHEEL, WM_SIZE, WM_VSCROLL, wmScroll |
Methods inherited from class org.eclipse.swt.widgets.Widget |
addDisposeListener, addListener, checkBits, checkParent, checkSubclass, checkWidget, dispose, error, filters, getData, getData, getName, getNameText, getStyle, hooks, isListening, isValidSubclass, isValidThread, mbcsToWcs, mbcsToWcs, notifyListeners, postEvent, postEvent, releaseChild, releaseResources, removeDisposeListener, removeListener, removeListener, sendEvent, sendEvent, sendEvent, sendEvent, setData, setData, setInputState, setKeyState, toString, wcsToMbcs, wcsToMbcs |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
int tabs
int oldStart
int oldEnd
boolean doubleClick
boolean ignoreVerify
boolean ignoreCharacter
public static final int LIMIT
public static final String DELIMITER
static final int EditProc
static final org.eclipse.swt.internal.win32.TCHAR EditClass
Constructor Detail |
public Text(Composite parent, int style)
The style value is either one of the style constants defined in
class SWT
which is applicable to instances of this
class, or must be built by bitwise OR'ing together
(that is, using the int
"|" operator) two or more
of those SWT
style constants. The class description
lists the style constants that are applicable to the class.
Style bits are also inherited from superclasses.
parent
- a composite control which will be the parent of the new instance (cannot be null)style
- the style of control to constructSWT.SINGLE
,
SWT.MULTI
,
SWT.READ_ONLY
,
SWT.WRAP
,
Widget.checkSubclass()
,
Widget.getStyle()
Method Detail |
int callWindowProc(int msg, int wParam, int lParam)
callWindowProc
in class Scrollable
void createHandle()
createHandle
in class Control
public void addModifyListener(ModifyListener listener)
ModifyListener
interface.
listener
- the listener which should be notifiedModifyListener
,
removeModifyListener(org.eclipse.swt.events.ModifyListener)
public void addSelectionListener(SelectionListener listener)
SelectionListener
interface.
widgetSelected
is not called for texts.
widgetDefaultSelected
is typically called when ENTER is pressed in a single-line text.
listener
- the listener which should be notifiedSelectionListener
,
removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,
SelectionEvent
public void addVerifyListener(VerifyListener listener)
VerifyListener
interface.
listener
- the listener which should be notifiedVerifyListener
,
removeVerifyListener(org.eclipse.swt.events.VerifyListener)
public void append(String string)
The new text is appended to the text at the end of the widget.
string
- the string to be appendedstatic int checkStyle(int style)
public void clearSelection()
public Point computeSize(int wHint, int hHint, boolean changed)
computeSize
in class Control
wHint
- the width hint (can be SWT.DEFAULT
)hHint
- the height hint (can be SWT.DEFAULT
)changed
- true
if the control's contents have changed, and false
otherwise
Layout
,
Control.getBorderWidth()
,
Control.getBounds()
,
Control.getSize()
,
Control.pack()
,
"computeTrim, getClientArea for controls that implement them"public void copy()
The current selection is copied to the clipboard.
void createWidget()
createWidget
in class Scrollable
public void cut()
The current selection is first copied to the clipboard and then deleted from the widget.
int defaultBackground()
defaultBackground
in class Control
public int getCaretLineNumber()
The line number of the caret is returned.
public Point getCaretLocation()
The location of the caret is returned.
public int getCaretPosition()
The character position of the caret is returned.
public int getCharCount()
String getClipboardText()
public boolean getDoubleClickEnabled()
The double click flag enables or disables the default action of the text widget when the user double clicks.
public char getEchoChar()
The echo character is the character that is displayed when the user enters text or the text is changed by the programmer.
public boolean getEditable()
public int getLineCount()
public String getLineDelimiter()
public int getLineHeight()
public Point getSelection()
Indexing is zero based. The range of a selection is from 0..N where N is the number of characters in the widget.
public int getSelectionCount()
public String getSelectionText()
public int getTabs()
Tab stop spacing is specified in terms of the space (' ') character. The width of a single tab stop is the pixel width of the spaces.
int getTabWidth(int tabs)
public String getText()
The text for a text widget is the characters in the widget.
public String getText(int start, int end)
Indexing is zero based. The range of a selection is from 0..N-1 where N is the number of characters in the widget.
start
- the start of the rangeend
- the end of the range
public int getTextLimit()
If this has not been changed by setTextLimit()
,
it will be the constant Text.LIMIT
.
public int getTopIndex()
This index can change when lines are scrolled or new lines are added or removed.
public int getTopPixel()
The top pixel is the pixel position of the line that is currently at the top of the widget. On some platforms, a text widget can be scrolled by pixels instead of lines so that a partial line is displayed at the top of the widget.
The top pixel changes when the widget is scrolled. The top pixel does not include the widget trimming.
public void insert(String string)
The old selection is replaced with the new text.
string
- the stringint mbcsToWcsPos(int mbcsPos)
public void paste()
The selected text is deleted from the widget and new text inserted from the clipboard.
public void removeModifyListener(ModifyListener listener)
listener
- the listener which should no longer be notifiedModifyListener
,
addModifyListener(org.eclipse.swt.events.ModifyListener)
public void removeSelectionListener(SelectionListener listener)
listener
- the listener which should be notifiedSelectionListener
,
addSelectionListener(org.eclipse.swt.events.SelectionListener)
public void removeVerifyListener(VerifyListener listener)
listener
- the listener which should be notifiedVerifyListener
,
addVerifyListener(org.eclipse.swt.events.VerifyListener)
public void selectAll()
boolean sendKeyEvent(int type, int msg, int wParam, int lParam, Event event)
sendKeyEvent
in class Control
void setBounds(int x, int y, int width, int height, int flags)
setBounds
in class Control
public void setDoubleClickEnabled(boolean doubleClick)
The double click flag enables or disables the default action of the text widget when the user double clicks.
doubleClick
- the new double click flagpublic void setEchoChar(char echo)
The echo character is the character that is displayed when the user enters text or the text is changed by the programmer. Setting the echo character to '\0' clears the echo character and redraws the original text. If for any reason the echo character is invalid, the default echo character for the platform is used.
echo
- the new echo characterpublic void setEditable(boolean editable)
editable
- the new editable statepublic void setFont(Font font)
setFont
in class Control
font
- the new font (or null)public void setSelection(int start)
Indexing is zero based. The range of a selection is from 0..N where N is the number of characters in the widget.
Text selections are specified in terms of caret positions. In a text widget that contains N characters, there are N+1 caret positions, ranging from 0..N. This differs from other functions that address character position such as getText () that use the regular array indexing rules.
start
- new caret positionpublic void setSelection(int start, int end)
Indexing is zero based. The range of a selection is from 0..N where N is the number of characters in the widget.
Text selections are specified in terms of caret positions. In a text widget that contains N characters, there are N+1 caret positions, ranging from 0..N. This differs from other functions that address character position such as getText () that use the usual array indexing rules.
start
- the start of the rangeend
- the end of the rangepublic void setRedraw(boolean redraw)
setRedraw
in class Control
redraw
- the new redraw stateControl.redraw()
,
Control.update()
public void setSelection(Point selection)
Indexing is zero based. The range of a selection is from 0..N where N is the number of characters in the widget.
Text selections are specified in terms of caret positions. In a text widget that contains N characters, there are N+1 caret positions, ranging from 0..N. This differs from other functions that address character position such as getText () that use the usual array indexing rules.
selection
- the pointpublic void setTabs(int tabs)
Tab stop spacing is specified in terms of the space (' ') character. The width of a single tab stop is the pixel width of the spaces.
tabs
- the number of tabs
void setTabStops(int tabs)
public void setText(String string)
public void setTextLimit(int limit)
Instead of trying to set the text limit to zero, consider creating a read-only text widget.
To reset this value to the default, use setTextLimit(Text.LIMIT)
.
limit
- new text limitpublic void setTopIndex(int index)
index
- the index of the top itempublic void showSelection()
If the selection is already showing in the receiver, this method simply returns. Otherwise, lines are scrolled until the selection is visible.
String verifyText(String string, int start, int end)
String verifyText(String string, int start, int end, Event keyEvent)
int wcsToMbcsPos(int wcsPos)
int widgetStyle()
widgetStyle
in class Scrollable
org.eclipse.swt.internal.win32.TCHAR windowClass()
windowClass
in class Scrollable
int windowProc()
windowProc
in class Scrollable
org.eclipse.swt.internal.win32.LRESULT WM_CHAR(int wParam, int lParam)
WM_CHAR
in class Control
org.eclipse.swt.internal.win32.LRESULT WM_CLEAR(int wParam, int lParam)
WM_CLEAR
in class Control
org.eclipse.swt.internal.win32.LRESULT WM_CUT(int wParam, int lParam)
WM_CUT
in class Control
org.eclipse.swt.internal.win32.LRESULT WM_GETDLGCODE(int wParam, int lParam)
WM_GETDLGCODE
in class Control
org.eclipse.swt.internal.win32.LRESULT WM_IME_CHAR(int wParam, int lParam)
WM_IME_CHAR
in class Control
org.eclipse.swt.internal.win32.LRESULT WM_LBUTTONDBLCLK(int wParam, int lParam)
WM_LBUTTONDBLCLK
in class Control
org.eclipse.swt.internal.win32.LRESULT WM_PASTE(int wParam, int lParam)
WM_PASTE
in class Control
org.eclipse.swt.internal.win32.LRESULT WM_UNDO(int wParam, int lParam)
WM_UNDO
in class Control
org.eclipse.swt.internal.win32.LRESULT wmCommandChild(int wParam, int lParam)
wmCommandChild
in class Control
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |