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

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

Introduction

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

Prototype

public void setTextLimit(int limit) 

Source Link

Document

Sets the text limit to the specified number of characters.

Usage

From source file:StyledTextLimit.java

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

    StyledText styledText = new StyledText(shell, SWT.V_SCROLL | SWT.BORDER);
    styledText.setText("12345");

    styledText.setTextLimit(10);

    styledText.setBounds(10, 10, 100, 100);
    shell.open();// www. j a  va 2s .  co  m
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();

}