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

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

Introduction

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

Prototype

public void cut() 

Source Link

Document

Moves the selected text to the clipboard.

Usage

From source file:StyledTextClipboard.java

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

    StyledText text1 = new StyledText(shell, SWT.V_SCROLL | SWT.WRAP | SWT.BORDER);
    StyledText text2 = new StyledText(shell, SWT.V_SCROLL | SWT.WRAP | SWT.BORDER);

    text1.setText("1234567");

    text1.setSelectionRange(2, 4);//from www.  j  a  va2s .c  o  m

    text1.cut();
    text2.paste();

    text1.setBounds(10, 10, 100, 100);

    text2.setBounds(10, 300, 100, 100);

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

}