I have a non editable text in SWT.
final Text textArea = new Text(parent, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
textArea.setVisible(false);
textArea.setEditable(false);
Color color=new Color(display,255,255,255);
textArea.setBackground(color);
When I click on the text area, the cursor is still visible. I do not want the cursor to be visible at all. I would appreciate any help. Thanks.
If you want the hide "blinking text cursor in the text", disable the Text
by calling Text#setEnabled(false)
.
If you don't want the mouse cursor to change to the text cursor when you hover over the text, set the Cursor
of the Text
to SWT.CURSOR_ARROW
by calling Text#setCursor(int)
.
public static void main(String[] args)
{
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setText("StackOverflow");
shell.setLayout(new FillLayout());
Text text = new Text(shell, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
text.setText("fdfsdfsd");
text.setEditable(false);
text.setEnabled(false);
text.setCursor(Display.getCurrent().getSystemCursor(SWT.CURSOR_ARROW));
shell.pack();
shell.open();
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
{
display.sleep();
}
}
display.dispose();
}