-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyLine.java
More file actions
32 lines (26 loc) · 789 Bytes
/
MyLine.java
File metadata and controls
32 lines (26 loc) · 789 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
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package java2ddrawingapplication;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Point;
import java.awt.Stroke;
import java.awt.geom.Line2D;
/**
*
* @author Ismael Youssef
*/
public class MyLine extends MyShapes{
public MyLine(Point pntA, Point pntB, Paint paint, Stroke strk)
{
super(pntA, pntB, paint, strk);
}
@Override
public void draw(Graphics2D g2d){
g2d.setPaint(getPaint());
g2d.setStroke(getStroke());
g2d.draw(new Line2D.Double((int)(getStartPoint().getX()), (int)(getStartPoint().getY()), (int)(getEndPoint().getX()), (int)(getEndPoint().getY())));
}
}