7
我试图在追加字符串之后将SWT Text
的光标位置设置为最后。我知道更改SWT StyledText
的光标位置,但不确定SWT Text
。如果你们遇到了这个挑战,并发现这个解决方案很好地分享它。如何在SWT文本中设置光标位置
我试图在追加字符串之后将SWT Text
的光标位置设置为最后。我知道更改SWT StyledText
的光标位置,但不确定SWT Text
。如果你们遇到了这个挑战,并发现这个解决方案很好地分享它。如何在SWT文本中设置光标位置
public static void main(String[] args)
{
Display d = new Display();
final Shell shell = new Shell(d);
shell.setLayout(new GridLayout(1, false));
Text text = new Text(shell, SWT.BORDER);
text.setText("Some random text here...");
text.setSelection(text.getText().length());
shell.pack();
shell.open();
while (!shell.isDisposed())
while (!d.readAndDispatch())
d.sleep();
}
这将光标移动到结束。
非常感谢你的工作。 –
请使用尽可能多的标签来描述您的问题,而不仅仅是'swt'。 – Baz