@Override protected void processTouchReleased() { if (!input.isMoving()) { if (Click != null) { Click.UpClick(this, input.getTouchX(), input.getTouchY()); } } }
/** * Implements the method to handle requests as defined by the <code>ClickHandler</code> interface. * The request is only handled here. if the CTRL key was pressed. * * @see ClickHandler */ public void handleClick(Click click) { System.out.println("Panel is asked to handle the request..."); if (click.hasCtrlMask()) { System.out.println("Panel handles the request."); } else { if (successor == null) { throw new RuntimeException("request unhandled (end of chain reached)"); } else { successor.handleClick(click); } } }
@Override protected void processTouchDragged() { if (!locked) { if (getContainer() != null) { getContainer().sendToFront(this); } this.move(this.input.getTouchDX(), this.input.getTouchDY()); if (Click != null) { Click.DragClick(this, input.getTouchX(), input.getTouchY()); } this.updateIcon(); } }
/** 处理点击事件(请重载实现) */ public void doClick() { if (Click != null) { Click.DoClick(this); } }
public void click(int index) { Click click = clicks.get(index); if (click.getType() == Click.LEFT_CLICK) theGrid[click.y][click.x].leftClick(); else if (click.getType() == Click.RIGHT_CLICK) theGrid[click.y][click.x].rightClick(); }