Example #1
0
  private Rectangle getDisplayBounds(final Point location) {

    Rectangle displayBounds;
    final Monitor[] allMonitors = _ownerControl.getDisplay().getMonitors();

    if (allMonitors.length > 1) {
      // By default present in the monitor of the control
      displayBounds = _ownerControl.getMonitor().getBounds();
      final Point p = new Point(location.x, location.y);

      // Search on which monitor the event occurred
      Rectangle tmp;
      for (final Monitor element : allMonitors) {
        tmp = element.getBounds();
        if (tmp.contains(p)) {
          displayBounds = tmp;
          break;
        }
      }

    } else {
      displayBounds = _ownerControl.getDisplay().getBounds();
    }

    return displayBounds;
  }