-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSmilingFaceFunction.java
More file actions
47 lines (40 loc) · 1.1 KB
/
Copy pathSmilingFaceFunction.java
File metadata and controls
47 lines (40 loc) · 1.1 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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package assignment_10528808;
/**
*
* @author Mawutor
*/
import java.awt.*;
import javax.swing.JFrame;
public class SmilingFaceFunction extends Canvas
{
public void paint( Graphics g )
{
drawSmilingFace(g,100,100);
drawSmilingFace(g,400,350);
// etc
}
public void drawSmilingFace( Graphics g, int x, int y )
{
g.setColor(Color.yellow);
g.fillOval(0,0,300,300);
g.setColor(Color.blue);
g.fillOval(45,50,50,50);
g.fillOval(200,50,50,50);
g.setColor(Color.red);
g.fillArc(100,200,100,5,180,180);
}
public static void main(String[] args)
{
// You can change the title or size here if you want.
JFrame win = new JFrame("Smiling Face Function");
win.setSize(1024,768);
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
win.add( new SmilingFaceFunction() );
win.setVisible(true);
}
}