1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| PointSouris = new Point2D.Float(sourisXdetect, sourisYdetect);
Shape ShapeDetect;
boolean survol=false;
try{
for (int i=0; i<=ListDetectionElements.size()-1;i++){
ShapeDetect=(Shape)ListDetectionElements.get(i);
if(ShapeDetect.contains(PointSouris)){
Dessin.AfficherDessin();// affichage du dessin d'origine
NumeroPLusProche=i;
g2c.fill(ShapeDetect); //affichage shape trouvee
survol=true;
break;
}
else{ survol=false;
}
}//du for i
if (survol){Dessin.AfficherDessin();// affichage du dessin d'origine
survol=false;}
g2c.dispose(); gc.dispose();
}catch(Exception err) {System.out.println(err); err.printStackTrace();} |
Partager