import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
public class StyledTextPaint {
static String SEARCH_STRING = "box";
public static void main(String[] args) {
final Display display = new Display();
Shell shell = new Shell(display);
shell.setBounds(10, 10, 250, 250);
final StyledText text = new StyledText(shell, SWT.NONE);
text.setBounds(10, 10, 200, 200);
text.addListener(SWT.Paint, new Listener() {
public void handleEvent(Event event) {
System.out.println("paint");
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}