Guest User

Untitled

a guest
Jan 16th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. final Display display = new Display();
  2. Shell shell = new Shell(display);
  3. GridLayout gridLayout = new GridLayout();
  4. gridLayout.numColumns = 1;
  5. shell.setLayout(gridLayout);
  6.  
  7. final Text text1 = new Text (shell, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
  8. text1.setLayoutData(new GridData(GridData.FILL_BOTH));
  9.  
  10. text1.addKeyListener(new KeyAdapter() {
  11. public void keyPressed(KeyEvent e) {
  12. if(e.keyCode == SWT.CR) {
  13. String textData = text1.getText();
  14. text1.setText("");
  15. text1.setSelection(0);
  16. }
  17. }
  18. });
Add Comment
Please, Sign In to add comment