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

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

Introduction

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

Prototype

public void setLineIndent(int startLine, int lineCount, int indent) 

Source Link

Document

Sets the indent of the specified lines.

Usage

From source file:StyledTextIndentAlignmentJustify.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    StyledText styledText = new StyledText(shell, SWT.WRAP | SWT.BORDER);
    styledText.setText(text);/*ww  w  .  java  2  s  .c  om*/
    styledText.setLineIndent(0, 1, 50);
    styledText.setLineAlignment(2, 1, SWT.CENTER);
    styledText.setLineJustify(4, 1, true);
    styledText.setLineAlignment(6, 1, SWT.RIGHT);
    styledText.setLineJustify(6, 1, true);

    shell.setSize(300, 400);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:org.eclipse.swt.snippets.Snippet213.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Snippet 213");
    shell.setLayout(new FillLayout());
    StyledText styledText = new StyledText(shell, SWT.WRAP | SWT.BORDER);
    styledText.setText(text);/*from www .  ja va 2 s.  co  m*/
    styledText.setLineIndent(0, 1, 50);
    styledText.setLineAlignment(2, 1, SWT.CENTER);
    styledText.setLineJustify(4, 1, true);
    styledText.setLineAlignment(6, 1, SWT.RIGHT);
    styledText.setLineJustify(6, 1, true);

    shell.setSize(300, 400);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:org.eclipse.swt.snippets.Snippet331.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Snippet 331");
    shell.setLayout(new FillLayout());
    StyledText styledText = new StyledText(shell, SWT.WRAP | SWT.BORDER);
    styledText.setText(text);// www.  j a  va2s . c o m
    styledText.setLineIndent(0, 1, 50);
    styledText.setLineIndent(2, 1, 50);
    styledText.setLineWrapIndent(2, 1, 50);
    styledText.setLineWrapIndent(4, 1, 50);

    StyleRange style = new StyleRange();
    style.metrics = new GlyphMetrics(0, 0, 50);
    Bullet bullet = new Bullet(style);
    styledText.setLineBullet(6, 1, bullet);
    styledText.setLineBullet(8, 1, bullet);
    styledText.setLineWrapIndent(8, 1, 50);

    shell.setSize(350, 550);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}