-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResolvesGraphics.java
More file actions
43 lines (33 loc) · 880 Bytes
/
ResolvesGraphics.java
File metadata and controls
43 lines (33 loc) · 880 Bytes
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
import java.awt.BasicStroke;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import javax.swing.JPanel;
public class ResolvesGraphics extends JPanel {
private Point A;
private Point B;
private Point C;
public ResolvesGraphics() {
super();
A = new Point(0, 0);
B = new Point(0, 0);
C = new Point(0, 0);
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setStroke(new BasicStroke(5));
g.drawLine(A.getX(), A.getY(), B.getX(), B.getY());
g.drawLine(A.getX(), A.getY(), C.getX(), C.getY());
g.drawLine(B.getX(), B.getY(), C.getX(), C.getY());
}
public void setA(Point newPoint) {
A = newPoint;
}
public void setB(Point newPoint) {
B = newPoint;
}
public void setC(Point newPoint) {
C = newPoint;
}
}