-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTriangle.java
104 lines (81 loc) · 1.62 KB
/
Triangle.java
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import javax.swing.*;
import java.awt.*;
public class Triangle extends Figures {
private int x;
private int y;
private int x2;
private int y2;
private int x3;
private int y3;
private int couleurf;
private boolean estRemplie;
//constructeur
public Triangle(int x, int y, int x2, int y2,int x3, int y3, int couleurf,boolean estRemplie) {
super("Triangle");
this.x = x;
this.y = y;
this.x2 = x2;
this.y2 = y2;
this.x3 = x3;
this.y3 = y3;
this.couleurf = couleurf;
this.estRemplie = estRemplie;
}
public Triangle() {
super("Triangle");
}
//pour dessiner
public void dessiner(Graphics g){
int xpoints[] = {this.x,this.x2, this.x3};
int ypoints[] = {this.y,this.y2, this.y3};
if (this.estRemplie == false) {
g.drawPolygon(xpoints, ypoints, 3);
}
else {
g.fillPolygon(xpoints, ypoints, 3);
}
}
// getters et setters
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getX2() {
return x2;
}
public void setX2(int x2) {
this.x2 = x2;
}
public int getY2() {
return y2;
}
public void setY2(int y2) {
this.y2 = y2;
}
public int getX3() {
return x3;
}
public void setX3(int x3) {
this.x3 = x3;
}
public int getY3() {
return y3;
}
public void setY3(int y3) {
this.y3 = y3;
}
public int getCouleurf() {
return this.couleurf;
}
public boolean estRemplie() {
return this.estRemplie;
}
}