@Override public void mouseClicked(MouseEvent arg0) { ObjetTT contenu; Point2D pointUsable = getPhysicPoint(arg0.getX(), arg0.getY()); int i = (int) (pointUsable.getX()); int j = (int) (pointUsable.getY()); contenu = physics.detail(i, j); if (contenu.getType() == Physique.type.tank) { highlightTank = (Tank) contenu; triggerTankSelectionListeners((DTank) contenu); } else highlightTank = null; }
@Override public void paintComponent(Graphics g) { g.setColor(Color.black); g.fillRect(0, 0, this.getWidth(), this.getHeight()); centrage(g); ObjetTT contenu; for (int i = 0; i < physics.getLignes(); i++) for (int j = 0; j < physics.getColonnes(); j++) { int x = i * tailleCase; int y = j * tailleCase; contenu = physics.detail(i, j); contenu.paint(g, x, y); if (highlightTank == contenu) { paintHighlight(g, x, y); } } }