Esempio n. 1
0
 @Override
 public void mouseClicked(MouseEvent m) {
   try {
     action.actionPerformed(new ActionEvent(m, 0, m.toString()));
   } catch (Throwable t) {
     Mistake.stop(t);
   }
 }
Esempio n. 2
0
 @Override
 public void mouseDragged(MouseEvent e) {
   Component dragged = e.getComponent();
   if (dragged instanceof BugLabel) {
     BugLabel bugLabel = (BugLabel) dragged;
     bugLabel.bug.setXY(e.getX() + bugLabel.getX(), e.getY() + bugLabel.getY());
     parent.worldStatusPanel.updateStats();
   } else if (dragged instanceof JouleLabel) {
     JouleLabel jouleLabel = (JouleLabel) dragged;
     jouleLabel.joule.setXY(e.getX() + jouleLabel.getX(), e.getY() + jouleLabel.getY());
   } else {
     System.err.println("Unexpected Drag Event: " + e.toString());
   }
 }
 @Override
 public void mouseClicked(MouseEvent e) {
   System.out.println(e.toString());
   if (moveSelected) {
     Position moveTo = can_board.getBoardPosition(e.getX(), e.getY());
     if (goc.validMove(moveTo)) {
       goc.move(moveTo);
       moveSelected = false;
       can_board.setBoard(goc.getBoard());
       btn_accuse.setEnabled(true);
       if (!goc.getPlayerPos().isRoom()) {
         endTurn();
       } else {
         btn_move.setEnabled(false);
         btn_guess.setEnabled(true);
       }
     }
   }
 }