bonjour,
dans le cadre d'un projet universitaire, j'ai besoin de tracer des cercles dans un grand cercle.
Pour cela je creer des cercles, C0 est le grand cercle
je veux tracer le cercle CO au milieu de ma Jframe et que les autres cercles soit placés par rapport au centre de C0;
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 Cercle(x,y,rayon); C0=(0,0,400); C1=(200,0,100); C2=(-100,10,100);
le probleme c'est sur papier c'est tout a fait logique alors que sur une Jframe la placement et totalement abérant.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 paintComponent(Graphics g) { g.fillOval((int)(getWidth()/2)-C0.rayon),(int)(getHeight()/2)-C0.rayon),(int)C0.rayon,(int)C0.rayon); g.fillOval((int)(getWidth()/2)-C0.rayon)+C0.rayon+C1.X-C1.rayon,(int)getHeight()/2)-C0.rayon)+C0.rayon+C1.Y-C1.rayon,(int)C0.rayon,(int)C0.rayon); g.fillOval((int)(getWidth()/2)-C0.rayon)+C0.rayon+C2.X-C2.rayon,(int)getHeight()/2)-C0.rayon)+C0.rayon+C2.Y-C1.rayon,(int)C0.rayon,(int)C0.rayon); }
je vous réexplique le soucis, j'ai un grand cercle C0 qui doit etre placer au milieu de la JFrame, ensuite par rapport au centre de C0 je trace les autres cercles
Si qq1 sait d'ou vient ce probleme !!!!!
merci
Partager