SWT RichTextEditor Overview PDF Print E-mail
The SWT RichTextEditor is a library providing a widget containing a StyledText field with a toolbar allowing the editing of styles in the text area. This is illustrated as follows:


The library provides a clean interface and base implementation which can be specialised for specific formats. A HTML implementation is also provided by the library. This means you don't have to write any code to convert between HTML and the styles used by the SWT StyledText widget. This is illustrated as follows:


The library is also flexible with respect to the features it provides through the user interface. This means various aspects of the functionality can be disabled to restrict the user interface where appropriate. The following example shows fewer toolbar items than the first example provided.


Notice also in the example above that different toolbar images are used and different styles have been applied to conform with the Eclipse editor L&F.

Getting Started with the SWT RichTextEdior PDF Print E-mail
Download and start using the SWT RichtextEditor by clicking on the link below.


To help you get started, there is also some example code at

You can download the JavaDoc here.

You can use your own icons or download any of the following sets:

Register RichTextEditor PDF Print E-mail
To register your copy of RichTextEditor, just follow these steps:
  1. Click the button at the bottom of this page to pay using PayPal.
  2. After paying, you will be taken back to this web site to a page showing your registration key. This key should then be entered into RichTextEditor by making the following call in your code:
    RichTextEditorWidget.setRegistrationKey("your registration key");
RichTextEditor Example Code PDF Print E-mail
final String menuHeaderName = "Edit";
final boolean preventTypingOfHTMLTags = true;
final int compositeStyle = SWT.BORDER;
final int toolBarStyle = SWT.NULL;
final int styledTextStyle = SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.WRAP;

RichTextEditorWidgetFeatureSet featureSet = RichTextEditorWidgetFeatureSet.ALL_FEATURES;
IStyledTextWidgetImageCreator imageCreator = new RichTextEditorWidgetBasicImageCreator(
		iconsDirPath, false);

Composite parent = shell;
htmlTextEditorWidget = new HTMLTextEditorWidget(

// The SWT RichTextEditor relies on GridData for its layout information...
GridData gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
gridData.horizontalAlignment = SWT.BEGINNING;
gridData.verticalAlignment = SWT.BEGINNING;
gridData.minimumWidth = 200;
gridData.minimumHeight = 50;

// Now set the content in your format (HTML in this case, but you could write
// other converters for other content types)...
HTMLTextModel htmlTextModel = new HTMLTextModel(htmlContent);