1

当我只有坐标x和y时,我正在swt(eclipse平台)中寻找方法或东西来获得控制。我发现只有这个

Display.getDefault().getCursorControl();

但这不是我要找的。我想要类似 getControlByCoordinates(int x, in y) 的东西。

4

1 回答 1

1

There is no such method which returns the Control by coordinates.

You need to

  1. Get the active Shell
  2. Iterate through all the children (Controls) recursively
  3. Invoke getBounds() on each Control
  4. Check if your Point intersect with the Rectangle.
于 2013-08-25T17:48:28.260 回答