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