public class Text extends Scrollable
Note: Only one of the styles MULTI and SINGLE may be specified, and only one of the styles LEFT, CENTER, and RIGHT may be specified.
Note: The styles ICON_CANCEL and ICON_SEARCH are hints used in combination with SEARCH. When the platform supports the hint, the text control shows these icons. When an icon is selected, a default selection event is sent with the detail field set to one of ICON_CANCEL or ICON_SEARCH. Normally, application code does not need to check the detail. In the case of ICON_CANCEL, the text is cleared before the default selection event is sent causing the application to search for an empty string.
IMPORTANT: This class is not intended to be subclassed.
Modifier and Type | Field and Description |
---|---|
(package private) boolean |
allowPasswordChar |
(package private) int |
clearSegmentsCount |
static java.lang.String |
DELIMITER
The delimiter used by multi-line text widgets.
|
(package private) boolean |
doubleClick |
(package private) static TCHAR |
EditClass |
(package private) static int |
EditProc |
(package private) boolean |
ignoreCharacter |
(package private) boolean |
ignoreModify |
(package private) boolean |
ignoreVerify |
static int |
LIMIT
The maximum number of characters that can be entered
into a text widget.
|
(package private) static char |
LTR_MARK |
(package private) java.lang.String |
message |
(package private) int |
oldEnd |
(package private) int |
oldStart |
(package private) static char |
RTL_MARK |
(package private) int[] |
segments |
(package private) int |
tabs |
horizontalBar, verticalBar
accessible, background, backgroundImage, cursor, drawCount, font, foreground, handle, layoutData, menu, parent, region, toolTipText
CANVAS, data, DEFAULT_HEIGHT, DEFAULT_WIDTH, DISABLED, display, DISPOSE_SENT, DISPOSED, DRAG_DETECT, DRAW_BACKGROUND, eventTable, FOREIGN_HANDLE, HIDDEN, IGNORE_WM_CHANGEUISTATE, KEYED_DATA, LAYOUT_CHANGED, LAYOUT_CHILD, LAYOUT_NEEDED, MAJOR, MINOR, MOVE_DEFERRED, MOVE_OCCURRED, PARENT_BACKGROUND, RELEASED, RESIZE_DEFERRED, RESIZE_OCCURRED, SKIN_NEEDED, state, style, THEME_BACKGROUND, TRACK_MOUSE
Constructor and Description |
---|
Text(Composite parent,
int style)
Constructs a new instance of this class given its parent
and a style value describing its behavior and appearance.
|
Modifier and Type | Method and Description |
---|---|
void |
addModifyListener(ModifyListener listener)
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 |
addSegmentListener(SegmentListener listener)
Adds a segment listener.
|
void |
addSelectionListener(SelectionListener listener)
Adds the listener to the collection of listeners who will
be notified when the control is selected by the user, by sending
it one of the messages defined in the
SelectionListener
interface. |
void |
addVerifyListener(VerifyListener listener)
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(java.lang.String string)
Appends a string.
|
(package private) void |
applySegments() |
(package private) int |
callWindowProc(int hwnd,
int msg,
int wParam,
int lParam) |
(package private) static int |
checkStyle(int style) |
(package private) void |
clearSegments(boolean applyText) |
void |
clearSelection()
Clears the selection.
|
Point |
computeSize(int wHint,
int hHint,
boolean changed)
Returns the preferred size of the receiver.
|
Rectangle |
computeTrim(int x,
int y,
int width,
int height)
Given a desired client area for the receiver
(as described by the arguments), returns the bounding
rectangle which would be required to produce that client
area.
|
void |
copy()
Copies the selected text.
|
(package private) void |
createHandle() |
(package private) void |
createWidget() |
void |
cut()
Cuts the selected text.
|
(package private) int |
defaultBackground() |
(package private) TCHAR |
deprocessText(TCHAR text,
int start,
int end,
boolean terminate) |
(package private) boolean |
dragDetect(int hwnd,
int x,
int y,
boolean filter,
boolean[] detect,
boolean[] consume) |
(package private) void |
fixAlignment() |
int |
getBorderWidth()
Returns the receiver's border width.
|
int |
getCaretLineNumber()
Returns the line number of the caret.
|
Point |
getCaretLocation()
Returns a point describing the location of the caret relative
to the receiver.
|
int |
getCaretPosition()
Returns the character position of the caret.
|
int |
getCharCount()
Returns the number of characters.
|
boolean |
getDoubleClickEnabled()
Returns the double click enabled flag.
|
char |
getEchoChar()
Returns the echo character.
|
boolean |
getEditable()
Returns the editable state.
|
int |
getLineCount()
Returns the number of lines.
|
java.lang.String |
getLineDelimiter()
Returns the line delimiter.
|
int |
getLineHeight()
Returns the height of a line.
|
java.lang.String |
getMessage()
Returns the widget message.
|
int |
getOrientation()
Returns the orientation of the receiver, which will be one of the
constants
SWT.LEFT_TO_RIGHT or SWT.RIGHT_TO_LEFT . |
(package private) int |
getPosition(Point point)
Returns the character position at the given point in the receiver
or -1 if no such position exists.
|
Point |
getSelection()
Returns a
Point whose x coordinate is the
character position representing the start of the selected
text, and whose y coordinate is the character position
representing the end of the selection. |
int |
getSelectionCount()
Returns the number of selected characters.
|
java.lang.String |
getSelectionText()
Gets the selected text, or an empty string if there is no current selection.
|
int |
getTabs()
Returns the number of tabs.
|
(package private) int |
getTabWidth(int tabs) |
java.lang.String |
getText()
Returns the widget text.
|
java.lang.String |
getText(int start,
int end)
Returns a range of text.
|
char[] |
getTextChars()
Returns the widget's text as a character array.
|
int |
getTextLimit()
Returns the maximum number of characters that the receiver is capable of holding.
|
int |
getTopIndex()
Returns the zero-relative index of the line which is currently
at the top of the receiver.
|
int |
getTopPixel()
Returns the top pixel.
|
void |
insert(java.lang.String string)
Inserts a string.
|
(package private) int |
mbcsToWcsPos(int mbcsPos) |
void |
paste()
Pastes text from clipboard.
|
(package private) void |
releaseWidget() |
void |
removeModifyListener(ModifyListener listener)
Removes the listener from the collection of listeners who will
be notified when the receiver's text is modified.
|
void |
removeSegmentListener(SegmentListener listener)
Removes the listener from the collection of listeners who will
be notified when the receiver's text is modified.
|
void |
removeSelectionListener(SelectionListener listener)
Removes the listener from the collection of listeners who will
be notified when the control is selected by the user.
|
void |
removeVerifyListener(VerifyListener listener)
Removes the listener from the collection of listeners who will
be notified when the control is verified.
|
void |
selectAll()
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) |
(package private) void |
setDefaultFont() |
void |
setDoubleClickEnabled(boolean doubleClick)
Sets the double click enabled flag.
|
void |
setEchoChar(char echo)
Sets the echo character.
|
void |
setEditable(boolean editable)
Sets the editable state.
|
void |
setFont(Font font)
Sets the font that the receiver will use to paint textual information
to the font specified by the argument, or to the default font for that
kind of control if the argument is null.
|
(package private) void |
setMargins() |
void |
setMessage(java.lang.String message)
Sets the widget message.
|
void |
setOrientation(int orientation)
Sets the orientation of the receiver, which must be one
of the constants
SWT.LEFT_TO_RIGHT or SWT.RIGHT_TO_LEFT . |
void |
setRedraw(boolean redraw)
If the argument is
false , causes subsequent drawing
operations in the receiver to be ignored. |
void |
setSelection(int start)
Sets the selection.
|
void |
setSelection(int start,
int end)
Sets the selection to the range specified
by the given start and end indices.
|
void |
setSelection(Point selection)
Sets the selection to the range specified
by the given point, where the x coordinate
represents the start index and the y coordinate
represents the end index.
|
void |
setTabs(int tabs)
Sets the number of tabs.
|
(package private) void |
setTabStops(int tabs) |
void |
setText(java.lang.String string)
Sets the contents of the receiver to the given string.
|
void |
setTextChars(char[] text)
Sets the contents of the receiver to the characters in the array.
|
void |
setTextLimit(int limit)
Sets the maximum number of characters that the receiver
is capable of holding to be the argument.
|
void |
setTopIndex(int index)
Sets the zero-relative index of the line which is currently
at the top of the receiver.
|
void |
showSelection()
Shows the selection.
|
(package private) int |
translateOffset(int offset) |
(package private) int |
untranslateOffset(int offset) |
(package private) void |
updateMenuLocation(Event event) |
(package private) void |
updateOrientation() |
(package private) java.lang.String |
verifyText(java.lang.String string,
int start,
int end,
Event keyEvent) |
(package private) int |
wcsToMbcsPos(int wcsPos) |
(package private) int |
widgetStyle() |
(package private) TCHAR |
windowClass() |
(package private) int |
windowProc() |
(package private) int |
windowProc(int hwnd,
int msg,
int wParam,
int lParam) |
(package private) LRESULT |
WM_CHAR(int wParam,
int lParam) |
(package private) LRESULT |
WM_CLEAR(int wParam,
int lParam) |
(package private) LRESULT |
WM_CUT(int wParam,
int lParam) |
(package private) LRESULT |
WM_ERASEBKGND(int wParam,
int lParam) |
(package private) LRESULT |
WM_GETDLGCODE(int wParam,
int lParam) |
(package private) LRESULT |
WM_GETOBJECT(int wParam,
int lParam) |
(package private) LRESULT |
WM_IME_CHAR(int wParam,
int lParam) |
(package private) LRESULT |
WM_LBUTTONDBLCLK(int wParam,
int lParam) |
(package private) LRESULT |
WM_LBUTTONDOWN(int wParam,
int lParam) |
(package private) LRESULT |
WM_PASTE(int wParam,
int lParam) |
(package private) LRESULT |
WM_UNDO(int wParam,
int lParam) |
(package private) LRESULT |
wmClipboard(int msg,
int wParam,
int lParam) |
(package private) LRESULT |
wmColorChild(int wParam,
int lParam) |
(package private) LRESULT |
wmCommandChild(int wParam,
int lParam) |
(package private) LRESULT |
wmKeyDown(int hwnd,
int wParam,
int lParam) |
createScrollBar, destroyScrollBar, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, releaseChildren, reskinChildren, scrolledHandle, widgetExtStyle, WM_HSCROLL, WM_MOUSEWHEEL, WM_SIZE, WM_VSCROLL, wmNCPaint, wmScroll, wmScrollWheel
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, binarySearch, borderHandle, checkBackground, checkBorder, checkBuffered, checkComposited, checkGesture, checkHandle, checkMirrored, computeSize, computeTabGroup, computeTabList, computeTabRoot, defaultFont, defaultForeground, deregister, destroyWidget, dragDetect, dragDetect, dragDetect, drawBackground, drawBackground, drawBackground, drawImageBackground, drawThemeBackground, enableDrag, enableWidget, fillBackground, fillImageBackground, fillThemeBackground, findBackgroundControl, findBrush, findCursor, findImageControl, findMenus, findMnemonic, findThemeControl, fixChildren, fixFocus, forceFocus, forceResize, getAccessible, getBackground, getBackgroundImage, getBackgroundPixel, getBounds, getClipboardText, getCodePage, getCursor, getDragDetect, getDrawing, getEnabled, getFont, getForeground, getForegroundPixel, getLayoutData, getLocation, getMenu, getMonitor, getParent, getPath, getRegion, getShell, getSize, getToolTipText, getTouchEnabled, getVisible, hasCursor, hasFocus, internal_dispose_GC, internal_new_GC, isActive, isEnabled, isFocusAncestor, isFocusControl, isReparentable, isShowing, isTabGroup, isTabItem, isVisible, mapEvent, markLayout, menuShell, mnemonicHit, mnemonicMatch, moveAbove, moveBelow, new_Accessible, new_GC, pack, pack, print, printWidget, redraw, redraw, redraw, redrawChildren, register, releaseHandle, releaseParent, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, sendFocusEvent, sendGestureEvent, sendMove, sendResize, sendTouchEvent, setBackground, setBackground, setBackgroundImage, setBackgroundImage, setBackgroundPixel, setBounds, setBounds, setBounds, setCapture, setCursor, setCursor, setDragDetect, setEnabled, setFocus, setForeground, setForegroundPixel, setLayoutData, setLocation, setLocation, setMenu, setParent, setRadioFocus, setRadioSelection, setRegion, setSavedFocus, setSize, setSize, setTabItemFocus, setToolTipText, setToolTipText, setTouchEnabled, setVisible, showWidget, sort, subclass, toControl, toControl, toDisplay, toDisplay, topHandle, translateAccelerator, translateMnemonic, translateMnemonic, translateTraversal, traverse, traverse, traverse, traverse, traverse, traverseEscape, traverseGroup, traverseItem, traverseMnemonic, traversePage, traverseReturn, unsubclass, update, update, updateBackgroundColor, updateBackgroundImage, updateBackgroundMode, updateFont, updateImages, updateLayout, widgetCreateStruct, widgetParent, WM_ACTIVATE, WM_CAPTURECHANGED, WM_CHANGEUISTATE, WM_CLOSE, WM_COMMAND, WM_CONTEXTMENU, WM_CTLCOLOR, WM_DESTROY, WM_DRAWITEM, WM_ENDSESSION, WM_ENTERIDLE, WM_GESTURE, WM_GETFONT, WM_GETMINMAXINFO, WM_HELP, WM_HOTKEY, WM_IME_COMPOSITION_START, WM_IME_COMPOSITION, WM_IME_ENDCOMPOSITION, WM_INITMENUPOPUP, WM_INPUTLANGCHANGE, WM_KEYDOWN, WM_KEYUP, WM_KILLFOCUS, WM_LBUTTONUP, WM_MBUTTONDBLCLK, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MEASUREITEM, WM_MENUCHAR, WM_MENUSELECT, WM_MOUSEACTIVATE, WM_MOUSEHOVER, WM_MOUSEHWHEEL, WM_MOUSELEAVE, WM_MOUSEMOVE, WM_MOVE, WM_NCACTIVATE, WM_NCCALCSIZE, WM_NCHITTEST, WM_NCLBUTTONDOWN, WM_NCPAINT, WM_NOTIFY, WM_PAINT, WM_PALETTECHANGED, WM_PARENTNOTIFY, WM_PRINT, WM_PRINTCLIENT, WM_QUERYENDSESSION, WM_QUERYNEWPALETTE, WM_QUERYOPEN, WM_RBUTTONDBLCLK, WM_RBUTTONDOWN, WM_RBUTTONUP, WM_SETCURSOR, WM_SETFOCUS, WM_SETFONT, WM_SETREDRAW, WM_SETTINGCHANGE, WM_SHOWWINDOW, WM_SYSCHAR, WM_SYSCOLORCHANGE, WM_SYSCOMMAND, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_TABLET_FLICK, WM_TIMER, WM_TOUCH, WM_UNINITMENUPOPUP, WM_UPDATEUISTATE, WM_WINDOWPOSCHANGED, WM_WINDOWPOSCHANGING, WM_XBUTTONDBLCLK, WM_XBUTTONDOWN, WM_XBUTTONUP, wmDrawChild, wmMeasureChild, wmNotify, wmNotifyChild, wmScrollChild
_addListener, addDisposeListener, addListener, checkBits, checkOpened, checkOrientation, checkParent, checkSubclass, checkWidget, DeferWindowPos, dispose, error, filters, findItem, fixMnemonic, fixMnemonic, getData, getData, getDisplay, getListeners, getName, getNameText, getStyle, hooks, isDisposed, isListening, isValidSubclass, isValidThread, notifyListeners, postEvent, postEvent, release, removeDisposeListener, removeListener, removeListener, reskin, reskinWidget, sendDragEvent, sendDragEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendKeyEvent, sendMouseEvent, sendMouseEvent, sendMouseWheelEvent, sendSelectionEvent, sendSelectionEvent, setData, setData, setInputState, setKeyState, setLocationMask, setTabGroupFocus, SetWindowPos, showMenu, showMenu, toString, wmCaptureChanged, wmChar, wmContextMenu, wmIMEChar, wmKeyUp, wmKillFocus, wmLButtonDblClk, wmLButtonDown, wmLButtonUp, wmMButtonDblClk, wmMButtonDown, wmMButtonUp, wmMouseHover, wmMouseHWheel, wmMouseLeave, wmMouseMove, wmMouseWheel, wmPaint, wmPrint, wmRButtonDblClk, wmRButtonDown, wmRButtonUp, wmSetFocus, wmSysChar, wmSysKeyDown, wmSysKeyUp, wmXButtonDblClk, wmXButtonDown, wmXButtonUp
int tabs
int oldStart
int oldEnd
boolean doubleClick
boolean ignoreModify
boolean ignoreVerify
boolean ignoreCharacter
boolean allowPasswordChar
java.lang.String message
int[] segments
int clearSegmentsCount
static final char LTR_MARK
static final char RTL_MARK
public static final int LIMIT
Note that this value is platform dependent, based upon the native widget implementation.
public static final java.lang.String DELIMITER
static final int EditProc
static final TCHAR EditClass
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 constructjava.lang.IllegalArgumentException
- SWTException
- SWT.SINGLE
,
SWT.MULTI
,
SWT.READ_ONLY
,
SWT.WRAP
,
SWT.LEFT
,
SWT.RIGHT
,
SWT.CENTER
,
SWT.PASSWORD
,
SWT.SEARCH
,
SWT.ICON_SEARCH
,
SWT.ICON_CANCEL
,
Widget.checkSubclass()
,
Widget.getStyle()
int callWindowProc(int hwnd, 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 notifiedjava.lang.IllegalArgumentException
- SWTException
- ModifyListener
,
removeModifyListener(org.eclipse.swt.events.ModifyListener)
public void addSegmentListener(SegmentListener listener)
A SegmentEvent
is sent whenever text content is being modified. The user can
customize appearance of text by indicating certain characters to be inserted
at certain text offsets. This may be used for bidi purposes, e.g. when
adjacent segments of right-to-left text should not be reordered relative to
each other.
E.g., Multiple Java string literals in a right-to-left language
should generally remain in logical order to each other, that is, the
way they are stored.
After SegmentListener is added, user may call setText(String)
for segments to take effect.
listener
- the listener which should be notifiedjava.lang.IllegalArgumentException
- SWTException
- SegmentEvent
,
SegmentListener
,
removeSegmentListener(org.eclipse.swt.events.SegmentListener)
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,
or when ENTER is pressed in a search text. If the receiver has the SWT.SEARCH | SWT.ICON_CANCEL
style
and the user cancels the search, the event object detail field contains the value SWT.ICON_CANCEL
.
Likewise, if the receiver has the SWT.ICON_SEARCH
style and the icon search is selected, the
event object detail field contains the value SWT.ICON_SEARCH
.
listener
- the listener which should be notified when the control is selected by the userjava.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,
SelectionEvent
public void addVerifyListener(VerifyListener listener)
VerifyListener
interface.listener
- the listener which should be notifiedjava.lang.IllegalArgumentException
- SWTException
- VerifyListener
,
removeVerifyListener(org.eclipse.swt.events.VerifyListener)
public void append(java.lang.String string)
The new text is appended to the text at the end of the widget.
string
- the string to be appendedjava.lang.IllegalArgumentException
- SWTException
- void applySegments()
static int checkStyle(int style)
void clearSegments(boolean applyText)
public void clearSelection()
SWTException
- public Point computeSize(int wHint, int hHint, boolean changed)
Control
The preferred size of a control is the size that it would
best be displayed at. The width hint and height hint arguments
allow the caller to ask a control questions such as "Given a particular
width, how high does the control need to be to show all of the contents?"
To indicate that the caller does not wish to constrain a particular
dimension, the constant SWT.DEFAULT
is passed for the hint.
If the changed flag is true
, it indicates that the receiver's
contents have changed, therefore any caches that a layout manager
containing the control may have been keeping need to be flushed. When the
control is resized, the changed flag will be false
, so layout
manager caches can be retained.
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
otherwiseLayout
,
Control.getBorderWidth()
,
Control.getBounds()
,
Control.getSize()
,
Control.pack(boolean)
,
"computeTrim, getClientArea for controls that implement them"public Rectangle computeTrim(int x, int y, int width, int height)
Scrollable
In other words, it returns a rectangle such that, if the receiver's bounds were set to that rectangle, the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings") would be the rectangle described by the arguments (relative to the receiver's parent).
computeTrim
in class Scrollable
x
- the desired x coordinate of the client areay
- the desired y coordinate of the client areawidth
- the desired width of the client areaheight
- the desired height of the client areaScrollable.getClientArea()
public void copy()
The current selection is copied to the clipboard.
SWTException
- void createWidget()
createWidget
in class Scrollable
public void cut()
The current selection is first copied to the clipboard and then deleted from the widget.
SWTException
- int defaultBackground()
defaultBackground
in class Control
boolean dragDetect(int hwnd, int x, int y, boolean filter, boolean[] detect, boolean[] consume)
dragDetect
in class Widget
void fixAlignment()
public int getBorderWidth()
Control
getBorderWidth
in class Control
public int getCaretLineNumber()
The line number of the caret is returned.
SWTException
- public Point getCaretLocation()
SWTException
- public int getCaretPosition()
Indexing is zero based.
SWTException
- public int getCharCount()
SWTException
- public boolean getDoubleClickEnabled()
The double click flag enables or disables the default action of the text widget when the user double clicks.
SWTException
- 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.
SWTException
- setEchoChar(char)
public boolean getEditable()
SWTException
- public int getLineCount()
SWTException
- public java.lang.String getLineDelimiter()
SWTException
- DELIMITER
public int getLineHeight()
SWTException
- public int getOrientation()
SWT.LEFT_TO_RIGHT
or SWT.RIGHT_TO_LEFT
.getOrientation
in class Control
SWTException
- public java.lang.String getMessage()
Typically this is used in conjunction with SWT.SEARCH
.
SWTException
- int getPosition(Point point)
Indexing is zero based.
SWTException
- public Point getSelection()
Point
whose x coordinate is the
character position representing the start of the selected
text, and whose y coordinate is the character position
representing the end of the selection. An "empty" selection
is indicated by the x and y coordinates having the same value.
Indexing is zero based. The range of a selection is from 0..N where N is the number of characters in the widget.
SWTException
- public int getSelectionCount()
SWTException
- public java.lang.String getSelectionText()
SWTException
- 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.
SWTException
- int getTabWidth(int tabs)
public java.lang.String getText()
The text for a text widget is the characters in the widget, or an empty string if this has never been set.
SWTException
- public char[] getTextChars()
The text for a text widget is the characters in the widget, or a zero-length array if this has never been set.
SWTException
- setTextChars(char[])
public java.lang.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 rangeSWTException
- public int getTextLimit()
If this has not been changed by setTextLimit()
,
it will be the constant Text.LIMIT
.
SWTException
- LIMIT
public int getTopIndex()
This index can change when lines are scrolled or new lines are added or removed.
SWTException
- 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.
SWTException
- public void insert(java.lang.String string)
The old selection is replaced with the new text.
string
- the stringjava.lang.IllegalArgumentException
- null
SWTException
- int mbcsToWcsPos(int mbcsPos)
public void paste()
The selected text is deleted from the widget and new text inserted from the clipboard.
SWTException
- void releaseWidget()
releaseWidget
in class Control
public void removeModifyListener(ModifyListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- SWTException
- ModifyListener
,
addModifyListener(org.eclipse.swt.events.ModifyListener)
public void removeSegmentListener(SegmentListener listener)
After SegmentListener is removed, user may call setText(String)
for segments to take effect.
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- SWTException
- SegmentEvent
,
SegmentListener
,
addSegmentListener(org.eclipse.swt.events.SegmentListener)
public void removeSelectionListener(SelectionListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
addSelectionListener(org.eclipse.swt.events.SelectionListener)
public void removeVerifyListener(VerifyListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- SWTException
- VerifyListener
,
addVerifyListener(org.eclipse.swt.events.VerifyListener)
public void selectAll()
SWTException
- boolean sendKeyEvent(int type, int msg, int wParam, int lParam, Event event)
sendKeyEvent
in class Widget
void setBounds(int x, int y, int width, int height, int flags)
void setDefaultFont()
setDefaultFont
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.
Note: This operation is a hint and is not supported on platforms that do not have this concept.
doubleClick
- the new double click flagSWTException
- public 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, or if the platform does not allow modification of the echo character, the default echo character for the platform is used.
echo
- the new echo characterSWTException
- public void setEditable(boolean editable)
editable
- the new editable stateSWTException
- public void setFont(Font font)
Control
void setMargins()
public void setMessage(java.lang.String message)
Typically this is used in conjunction with SWT.SEARCH
.
message
- the new messagejava.lang.IllegalArgumentException
- SWTException
- public void setOrientation(int orientation)
SWT.LEFT_TO_RIGHT
or SWT.RIGHT_TO_LEFT
.
Note: This operation is a hint and is not supported on platforms that do not have this concept.
setOrientation
in class Control
orientation
- new orientation styleSWTException
- 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 positionSWTException
- public 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 rangeSWTException
- public void setRedraw(boolean redraw)
Control
false
, causes subsequent drawing
operations in the receiver to be ignored. No drawing of any kind
can occur in the receiver until the flag is set to true.
Graphics operations that occurred while the flag was
false
are lost. When the flag is set to true
,
the entire widget is marked as needing to be redrawn. Nested calls
to this method are stacked.
Note: This operation is a hint and may not be supported on some platforms or for some widgets.
setRedraw
in class Control
redraw
- the new redraw stateControl.redraw(int, int, int, int, boolean)
,
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 pointjava.lang.IllegalArgumentException
- SWTException
- public 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
SWTException
- void setTabStops(int tabs)
public void setText(java.lang.String string)
string
- the new textjava.lang.IllegalArgumentException
- SWTException
- public void setTextChars(char[] text)
SWT.SINGLE
and the argument contains multiple lines of text
then the result of this operation is undefined and may vary between platforms.text
- a character array that contains the new textjava.lang.IllegalArgumentException
- SWTException
- getTextChars()
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)
.
Specifying a limit value larger than Text.LIMIT
sets the
receiver's limit to Text.LIMIT
.
limit
- new text limitjava.lang.IllegalArgumentException
- SWTException
- LIMIT
public void setTopIndex(int index)
index
- the index of the top itemSWTException
- public void showSelection()
If the selection is already showing in the receiver, this method simply returns. Otherwise, lines are scrolled until the selection is visible.
SWTException
- int translateOffset(int offset)
int untranslateOffset(int offset)
void updateMenuLocation(Event event)
updateMenuLocation
in class Widget
void updateOrientation()
updateOrientation
in class Control
java.lang.String verifyText(java.lang.String string, int start, int end, Event keyEvent)
int wcsToMbcsPos(int wcsPos)
int widgetStyle()
widgetStyle
in class Scrollable
TCHAR windowClass()
windowClass
in class Scrollable
int windowProc()
windowProc
in class Scrollable
int windowProc(int hwnd, int msg, int wParam, int lParam)
windowProc
in class Control
LRESULT WM_ERASEBKGND(int wParam, int lParam)
WM_ERASEBKGND
in class Control
LRESULT WM_GETDLGCODE(int wParam, int lParam)
WM_GETDLGCODE
in class Control
LRESULT WM_GETOBJECT(int wParam, int lParam)
WM_GETOBJECT
in class Control
LRESULT WM_IME_CHAR(int wParam, int lParam)
WM_IME_CHAR
in class Control
LRESULT WM_LBUTTONDBLCLK(int wParam, int lParam)
WM_LBUTTONDBLCLK
in class Control
LRESULT WM_LBUTTONDOWN(int wParam, int lParam)
WM_LBUTTONDOWN
in class Control
LRESULT wmClipboard(int msg, int wParam, int lParam)
LRESULT wmColorChild(int wParam, int lParam)
wmColorChild
in class Control
LRESULT wmCommandChild(int wParam, int lParam)
wmCommandChild
in class Control