Overview

 
Package  Use  Tree  Deprecated  Index  Help 
Eclipse Platform
Release 3.0
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD


 

org.eclipse.swt.widgets
Class Text

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Control
          extended byorg.eclipse.swt.widgets.Scrollable
              extended byorg.eclipse.swt.widgets.Text

All Implemented Interfaces:
Drawable


public class Text
extends Scrollable

Instances of this class are selectable user interface objects that allow the user to enter and modify text.

Styles:

CENTER, LEFT, MULTI, PASSWORD, SINGLE, RIGHT, READ_ONLY, WRAP

Events:

DefaultSelection, Modify, Verify

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
          The delimiter used by multi-line text widgets.
static int LIMIT
          The maximum number of characters that can be entered into a text widget.
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
Text(Composite parent, int style)
          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)
          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)
          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)
          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)
          Appends a string.
 void clearSelection()
          Clears the selection.
 Point computeSize(int wHint, int hHint, boolean changed)
          Returns the preferred size of the receiver.
 void copy()
          Copies the selected text.
 void cut()
          Cuts the selected text.
 int getBorderWidth()
          Returns the receiver's border width.
 int getCaretLineNumber()
          Gets the line number of the caret.
 Point getCaretLocation()
          Gets the location the caret.
 int getCaretPosition()
          Gets the position of the caret.
 int getCharCount()
          Gets the number of characters.
 boolean getDoubleClickEnabled()
          Gets the double click enabled flag.
 char getEchoChar()
          Gets the echo character.
 boolean getEditable()
          Gets the editable state.
 int getLineCount()
          Gets the number of lines.
 String getLineDelimiter()
          Gets the line delimiter.
 int getLineHeight()
          Gets the height of a line.
 int getOrientation()
          Returns the orientation of the receiver.
 Point getSelection()
          Gets the position of the selected text.
 int getSelectionCount()
          Gets the number of selected characters.
 String getSelectionText()
          Gets the selected text.
 int getTabs()
          Gets the number of tabs.
 String getText()
          Gets the widget text.
 String getText(int start, int end)
          Gets a range of text.
 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()
          Gets the top pixel.
 void insert(String string)
          Inserts a string.
 void paste()
          Pastes text from clipboard.
 void removeModifyListener(ModifyListener 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.
 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.
 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.
 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.
 void setSelection(Point selection)
          Sets the selection.
 void setTabs(int tabs)
          Sets the number of tabs.
 void setText(String string)
          Sets the contents of the receiver to the given string.
 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.
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setCursor, setEnabled, setFocus, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkSubclass, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

 

Field Detail

 

 

LIMIT

public static final int LIMIT

The maximum number of characters that can be entered into a text widget.


 

 

DELIMITER

public static final String DELIMITER

The delimiter used by multi-line text widgets. When text is queried and from the widget, it will be delimited using this delimiter.

Constructor Detail

 

 

Text

public Text(Composite parent,
            int style)

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

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.

Parameters:
parent - a composite control which will be the parent of the new instance (cannot be null)
style - the style of control to construct
Throws:
IllegalArgumentException -

SWTException -

See Also:
SWT.SINGLE, SWT.MULTI, SWT.READ_ONLY, SWT.WRAP, Widget.checkSubclass(), Widget.getStyle()
Method Detail

 

 

addModifyListener

public 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.

Parameters:
listener - the listener which should be notified
Throws:
IllegalArgumentException -

  • ERROR_NULL_ARGUMENT - if the listener is null

SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

See Also:
ModifyListener, removeModifyListener(org.eclipse.swt.events.ModifyListener)


 

 

addSelectionListener

public void addSelectionListener(SelectionListener listener)

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.

widgetSelected is not called for texts. widgetDefaultSelected is typically called when ENTER is pressed in a single-line text.

Parameters:
listener - the listener which should be notified
Throws:
IllegalArgumentException -

  • ERROR_NULL_ARGUMENT - if the listener is null

SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

See Also:
SelectionListener, removeSelectionListener(org.eclipse.swt.events.SelectionListener), SelectionEvent


 

 

addVerifyListener

public 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.

Parameters:
listener - the listener which should be notified
Throws:
IllegalArgumentException -

  • ERROR_NULL_ARGUMENT - if the listener is null

SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

See Also:
VerifyListener, removeVerifyListener(org.eclipse.swt.events.VerifyListener)


 

 

append

public void append(String string)

Appends a string.

The new text is appended to the text at the end of the widget.

Parameters:
string - the string to be appended
Throws:
IllegalArgumentException -

  • ERROR_NULL_ARGUMENT - if the string is null

SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

clearSelection

public void clearSelection()

Clears the selection.

Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

computeSize

public Point computeSize(int wHint,
                         int hHint,
                         boolean changed)

Description copied from class: Control
Returns the preferred size of the receiver.

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.

Overrides:
computeSize in class Control

Parameters:
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
Returns:
the preferred size of the control.
See Also:
Layout, Control.getBorderWidth(), Control.getBounds(), Control.getSize(), Control.pack(), "computeTrim, getClientArea for controls that implement them"


 

 

copy

public void copy()

Copies the selected text.

The current selection is copied to the clipboard.

Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

cut

public void cut()

Cuts the selected text.

The current selection is first copied to the clipboard and then deleted from the widget.

Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getBorderWidth

public int getBorderWidth()

Description copied from class: Control
Returns the receiver's border width.

Overrides:
getBorderWidth in class Control

Returns:
the border width


 

 

getCaretLineNumber

public int getCaretLineNumber()

Gets the line number of the caret.

The line number of the caret is returned.

Returns:
the line number
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getCaretLocation

public Point getCaretLocation()

Gets the location the caret.

The location of the caret is returned.

Returns:
a point, the location of the caret
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getCaretPosition

public int getCaretPosition()

Gets the position of the caret.

The character position of the caret is returned.

Returns:
the position of the caret
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getCharCount

public int getCharCount()

Gets the number of characters.

Returns:
number of characters in the widget
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getDoubleClickEnabled

public boolean getDoubleClickEnabled()

Gets the double click enabled flag.

The double click flag enables or disables the default action of the text widget when the user double clicks.

Returns:
whether or not double click is enabled
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getEchoChar

public char getEchoChar()

Gets the echo character.

The echo character is the character that is displayed when the user enters text or the text is changed by the programmer.

Returns:
the echo character
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getEditable

public boolean getEditable()

Gets the editable state.

Returns:
whether or not the reciever is editable
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getLineCount

public int getLineCount()

Gets the number of lines.

Returns:
the number of lines in the widget
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getLineDelimiter

public String getLineDelimiter()

Gets the line delimiter.

Returns:
a string that is the line delimiter
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getLineHeight

public int getLineHeight()

Gets the height of a line.

Returns:
the height of a row of text
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getOrientation

public int getOrientation()

Returns the orientation of the receiver.

Returns:
the orientation style
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

Since:
2.1.2


 

 

getSelection

public Point getSelection()

Gets the position of the selected text.

Indexing is zero based. The range of a selection is from 0..N where N is the number of characters in the widget.

Returns:
the start and end of the selection
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getSelectionCount

public int getSelectionCount()

Gets the number of selected characters.

Returns:
the number of selected characters.
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getSelectionText

public String getSelectionText()

Gets the selected text.

Returns:
the selected text
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getTabs

public int getTabs()

Gets the number of 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.

Returns:
the number of tab characters
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getText

public String getText()

Gets the widget text.

The text for a text widget is the characters in the widget.

Returns:
the widget text
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getText

public String getText(int start,
                      int end)

Gets a range of text. Returns an empty string if the start of the range is greater than the 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.

Parameters:
start - the start of the range
end - the end of the range
Returns:
the range of text
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getTextLimit

public int getTextLimit()

Returns the maximum number of characters that the receiver is capable of holding.

If this has not been changed by setTextLimit(), it will be the constant Text.LIMIT.

Returns:
the text limit
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getTopIndex

public int getTopIndex()

Returns the zero-relative index of the line which is currently at the top of the receiver.

This index can change when lines are scrolled or new lines are added or removed.

Returns:
the index of the top line
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

getTopPixel

public int getTopPixel()

Gets the top pixel.

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.

Returns:
the pixel position of the top line
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

insert

public void insert(String string)

Inserts a string.

The old selection is replaced with the new text.

Parameters:
string - the string
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

paste

public void paste()

Pastes text from clipboard.

The selected text is deleted from the widget and new text inserted from the clipboard.

Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

removeModifyListener

public void removeModifyListener(ModifyListener listener)

Removes the listener from the collection of listeners who will be notified when the receiver's text is modified.

Parameters:
listener - the listener which should no longer be notified
Throws:
IllegalArgumentException -

  • ERROR_NULL_ARGUMENT - if the listener is null

SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

See Also:
ModifyListener, addModifyListener(org.eclipse.swt.events.ModifyListener)


 

 

removeSelectionListener

public void removeSelectionListener(SelectionListener listener)

Removes the listener from the collection of listeners who will be notified when the control is selected.

Parameters:
listener - the listener which should be notified
Throws:
IllegalArgumentException -

  • ERROR_NULL_ARGUMENT - if the listener is null

SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

See Also:
SelectionListener, addSelectionListener(org.eclipse.swt.events.SelectionListener)


 

 

removeVerifyListener

public void removeVerifyListener(VerifyListener listener)

Removes the listener from the collection of listeners who will be notified when the control is verified.

Parameters:
listener - the listener which should be notified
Throws:
IllegalArgumentException -

  • ERROR_NULL_ARGUMENT - if the listener is null

SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

See Also:
VerifyListener, addVerifyListener(org.eclipse.swt.events.VerifyListener)


 

 

selectAll

public void selectAll()

Selects all the text in the receiver.

Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

setDoubleClickEnabled

public void setDoubleClickEnabled(boolean doubleClick)

Sets the double click enabled flag.

The double click flag enables or disables the default action of the text widget when the user double clicks.

Parameters:
doubleClick - the new double click flag
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

setEchoChar

public void setEchoChar(char echo)

Sets the echo character.

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.

Parameters:
echo - the new echo character
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

setEditable

public void setEditable(boolean editable)

Sets the editable state.

Parameters:
editable - the new editable state
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

setFont

public void setFont(Font font)

Description copied from class: Control
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.

Overrides:
setFont in class Control

Parameters:
font - the new font (or null)


 

 

setOrientation

public 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.

Parameters:
orientation - new orientation style
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

Since:
2.1.2


 

 

setSelection

public void setSelection(int start)

Sets the 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 regular array indexing rules.

Parameters:
start - new caret position
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

setSelection

public void setSelection(int start,
                         int end)

Sets the 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.

Parameters:
start - the start of the range
end - the end of the range
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

setRedraw

public void setRedraw(boolean redraw)

Description copied from class: Control
If the argument is 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.

Note: This operation is a hint and may not be supported on some platforms or for some widgets.

Overrides:
setRedraw in class Control

Parameters:
redraw - the new redraw state
See Also:
Control.redraw(), Control.update()


 

 

setSelection

public void setSelection(Point selection)

Sets the 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.

Parameters:
selection - the point
Throws:
IllegalArgumentException -

  • ERROR_NULL_ARGUMENT - if the point is null

SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

setTabs

public void setTabs(int tabs)

Sets the number of 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.

Parameters:
tabs - the number of tabs

Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

setText

public void setText(String string)

Sets the contents of the receiver to the given string. If the receiver has style SINGLE and the argument contains multiple lines of text, the result of this operation is undefined and may vary from platform to platform.

Parameters:
string - the new text
Throws:
IllegalArgumentException -

  • ERROR_NULL_ARGUMENT - if the string is null

SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

setTextLimit

public void setTextLimit(int limit)

Sets the maximum number of characters that the receiver is capable of holding to be the argument.

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).

Parameters:
limit - new text limit
Throws:
IllegalArgumentException -

  • ERROR_CANNOT_BE_ZERO - if the limit is zero

SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

setTopIndex

public void setTopIndex(int index)

Sets the zero-relative index of the line which is currently at the top of the receiver. This index can change when lines are scrolled or new lines are added and removed.

Parameters:
index - the index of the top item
Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

 

showSelection

public void showSelection()

Shows the selection.

If the selection is already showing in the receiver, this method simply returns. Otherwise, lines are scrolled until the selection is visible.

Throws:
SWTException -

  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver


 

Overview

 
Package  Use  Tree  Deprecated  Index  Help 
Eclipse Platform
Release 3.0
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD


Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.