예제 #1
0
  public static void clickHWall(BoardGui frame, Robot bot, Board board, int sectNum) {
    int xInstersectOffset = 7;
    int yInstersectOffset = 51;
    // Rest for a little while
    try {
      Thread.sleep(900, 000);
    } catch (InterruptedException e) {
    }

    // Intersects
    bot.mouseMove(
        frame.sect.get(sectNum).getX() + xInstersectOffset,
        frame.sect.get(sectNum).getY() + yInstersectOffset);

    bot.mousePress(InputEvent.BUTTON1_MASK);
    // add time between press and release or the input event system may
    // not think it is a click
    try {
      Thread.sleep(250);
    } catch (InterruptedException e) {
    }
    bot.mouseRelease(InputEvent.BUTTON1_MASK);

    try {
      Thread.sleep(250);
    } catch (InterruptedException e) {
    }
    frame.submitHWall();

    frame.labels[board.getCurrPlayer()].setText(
        "\t\t\t " + board.getWallCount(board.getCurrPlayer()) + " walls remain");
    frame.labels[board.getCurrPlayer()].repaint();

    frame.control.iteratePlayers(board, board.getPlayerCount());
  }