-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOval.java
More file actions
33 lines (28 loc) · 805 Bytes
/
Copy pathOval.java
File metadata and controls
33 lines (28 loc) · 805 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
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
public class Oval implements Sprite{
private int width;
private int height;
private Color color;
public Oval(int width, int height, Color color) {
this.width = width;
this.height = height;
this.color = color;
}
public void draw(Graphics surface, int x, int y) {
// Draw the object
surface.setColor(color);
surface.fillOval(x, y, width, height);
surface.setColor(Color.BLACK);
((Graphics2D) surface).setStroke(new BasicStroke(3.0f));
surface.drawOval(x, y, width, height);
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
}