Add Caret to Shell (window) : Caret « SWT « Java Tutorial






Add Caret to Shell (window)
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Caret;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class CaretShell {

  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    Caret caret = new Caret(shell, SWT.NONE);
    caret.setBounds(10, 10, 2, 32);
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    display.dispose();
  }
}








17.76.Caret
17.76.1.Add Caret to Shell (window)Add Caret to Shell (window)
17.76.2.Use Image as a caretUse Image as a caret