-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphicsDemo2.java
More file actions
43 lines (33 loc) · 951 Bytes
/
Copy pathGraphicsDemo2.java
File metadata and controls
43 lines (33 loc) · 951 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.*;
import javax.swing.JFrame;
public class GraphicsDemo2 extends Canvas
{
public void paint( Graphics g )
{
g.setColor(Color.black);
g.drawRect(50,20,100,200);
g.drawOval(160,20,100,200);
g.drawArc(270,20,100,200,0,270);
g.drawArc(50,250,150,150,90,180);
g.drawArc(210,250,150,150,45,90);
g.fillArc(210,280,150,150,45,90);
g.setColor(Color.black);
g.fillArc(150,400,150,150,45,270);
g.fillArc(450,400,100,100,225,270);
Color myOrange = new Color(230,92,0);
g.setColor(myOrange);
g.fillOval(550,100,50,50);
Color myGrey = new Color(238,238,238);
g.setColor(myGrey);
g.fillOval(550,100,50,50);
}
public static void main( String[] args)
{
JFrame win = new JFrame("GraphicsDemo2: Arcs and Colors");
win.setSize(800,600);
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GraphicsDemo2 canvas = new GraphicsDemo2();
win.add( canvas );
win.setVisible(true);
}
}