Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/377.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 文本SWT中的光标可见性_Java_Swt - Fatal编程技术网

Java 文本SWT中的光标可见性

Java 文本SWT中的光标可见性,java,swt,Java,Swt,我在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); 当我单击文本区域时,光标仍然可见。我根本不希望

我在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);
当我单击文本区域时,光标仍然可见。我根本不希望光标可见。我将感谢任何帮助。谢谢。

如果要隐藏“文本中闪烁的文本光标”,请通过调用
text\setEnabled(false)
禁用
文本

如果您不希望鼠标光标在文本上方悬停时变为文本光标,请通过调用
text\setCursor(int)
text
光标设置为
SWT.cursor\u ARROW


你是说文字光标/插入符号吗?是的。我是说文字光标。谢谢你做得漂亮。非常感谢。
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();
}