Example usage for org.eclipse.swt.custom StyledText setLineBackground

List of usage examples for org.eclipse.swt.custom StyledText setLineBackground

Introduction

In this page you can find the example usage for org.eclipse.swt.custom StyledText setLineBackground.

Prototype

public void setLineBackground(int startLine, int lineCount, Color background) 

Source Link

Document

Sets the background color of the specified lines.

Usage

From source file:StyledTextLineBackground.java

public static void main(String[] args) {
    final Display display = new Display();
    final Shell shell = new Shell(display);

    final StyledText styledText = new StyledText(shell, SWT.V_SCROLL | SWT.BORDER);
    styledText.setText("\n1234\n124\n\1234\n12314\n\1241234\n");

    styledText.setLineBackground(0, 6, Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));

    styledText.setBounds(10, 10, 500, 100);
    shell.open();// w ww . ja  va2  s  .c  o  m
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();
}