2013-08-21 6 views

ответ

3

Это получает положение курсора относительно текущего дисплея:

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); 
Смежные вопросы