Salut j'ai un problème avec Comment mettre les fonctions rotate() et translate() actives dans ce petit Programme ou est ce qu'elle doit être Appelé la fonction et comment ? + quelque information additionnel si vous pouvez !
Merci !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 package biketire; import java.awt.*; import java.awt.event.*; import java.awt.geom.*; /** * @author Marshall */ public class Main extends Frame { public int xCenter=70; public int yCenter=330; public int xPrim=70; public int yPrim=660; public int Diam=70; Line2D Ground = new Line2D.Double(900,400 ,50 ,400); Ellipse2D Tire = new Ellipse2D.Double(xCenter,yCenter,Diam,Diam); Stroke drawingStroke = new BasicStroke(2); public void paint(Graphics g) { Graphics2D graph = (Graphics2D)g; graph.setStroke(drawingStroke); graph.setPaint(Color.BLACK); graph.draw(Ground); graph.draw(Tire); for (int i=0; i<16; i++) { graph.translate(xPrim, yPrim); } } public static void main(String[] args) { // TODO code application logic here Frame frame = new Main(); frame.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent we){ System.exit(0); } }); frame.setSize(950,1000); frame.setVisible(true); } }
Partager