Class TextWithImage

All Implemented Interfaces:
Drawable

public class TextWithImage extends Composite
A text box with a label at the left hand side.
  • Constructor Details

    • TextWithImage

      public TextWithImage(Composite parent, int style)
  • Method Details

    • dispose

      public void dispose()
      Overrides:
      dispose in class Widget
    • getTextElement

      public Text getTextElement()
      Get the underlying text widget instance.
      Returns:
      text widget
    • setImage

      public void setImage(Image image)
      Sets the receiver's image to the argument, which may be null indicating that no image should be displayed.
      Parameters:
      image - the image to display on the receiver (may be null)
      Throws:
      IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the image has been disposed
      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()
      Returns the widget text.

      The text for a text widget is the characters in the widget, or an empty string if this has never been set.

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

      Note: If control characters like '\n', '\t' etc. are used in the string, then the behavior is platform dependent.

      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