如何使用SWT获取当前光标的位置?
我需要:
- 绝对位置(仅相对于当前的
Display
) - 相对于当前活动
Control
的位置
如何使用SWT获取当前光标的位置?
我需要:
Display
)Control
的位置这将获取光标位置相对于当前显示器:
import org.eclipse.swt.widgets.Display;
[...]
Point cursorLocation = Display.getCurrent().getCursorLocation();
import org.eclipse.swt.widgets.Display;
[...]
Point cursorLocation = Display.getCurrent().getCursorLocation();
Point relativeCursorLocation = Display.getCurrent().getFocusControl().toControl(cursorLocation);