-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathScene.java
More file actions
55 lines (53 loc) · 1.31 KB
/
Scene.java
File metadata and controls
55 lines (53 loc) · 1.31 KB
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
import java.awt.*;
/**
* Write a description of class Scene here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Scene
{
// instance variables - replace the example below with your own
private int width;
private int height;
private Color HC;
private Color GC;
private Color SC;
/**
* Constructor for objects of class Scene
*/
public Scene()
{
// initialise instance variables
width = 500;
height = 500;
HC = Color.CYAN;
GC = Color.GREEN;
SC = Color.YELLOW;
}
public Scene(int width, int height, Color HC,Color GC, Color SC)
{
// initialise instance variables
this.width = width;
this.height = height;
this.HC = HC;
this.GC = GC;
this.SC = SC;
}
/**
* An example of a method - replace this comment with your own
*
* @param y a sample parameter for a method
* @return the sum of x and y
*/
public void drawScene(Graphics g)
{
// put your code here
g.setColor(HC);
g.fillRect(0,0,width,height);
g.setColor(GC);
g.fillRect(0,height -200,width,height - 250);
g.setColor(SC);
g.fillOval(width - 150,0,width - 400,height - 400);
}
}