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

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

Introduction

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

Prototype

public void setLineJustify(int startLine, int lineCount, boolean justify) 

Source Link

Document

Sets the justify 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);//from w  w w .  jav  a2s .  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.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);//w w w . ja  v  a 2  s. c  o  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();
}