Пример #1
0
  @Override
  public Widget mouseClick(int x, int y, int button) {
    super.mouseClick(x, y, button);

    x -= bounds.x;
    y -= bounds.y;

    for (Widget child : children) {
      if (child.getBounds().contains(x, y)) {
        focus = child.mouseClick(x, y, button);
        return this;
      }
    }

    return null;
  }
Пример #2
0
  @Override
  public void mouseMove(int x, int y) {
    super.mouseMove(x, y);

    x -= bounds.x;
    y -= bounds.y;

    if (focus != null) {
      focus.mouseMove(x, y);
    } else {
      for (Widget child : children) {
        if (child.getBounds().contains(x, y)) {
          child.mouseMove(x, y);
          return;
        }
      }
    }
  }