-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAClockFace.java
More file actions
50 lines (44 loc) · 1.32 KB
/
Copy pathAClockFace.java
File metadata and controls
50 lines (44 loc) · 1.32 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
/*
* 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 javax.swing.JFrame;
import java.awt.*;
public class AClockFace extends Canvas
{
public void paint( Graphics g )
{
g.setColor(Color.WHITE);
g.fillOval(0,0,300,300);
g.setColor(Color.black);
g.drawString("12",150,10 );
g.drawString("9",0,150 );
g.drawString("3",290,150 );
g.drawString("6",150,290 );
g.fillOval(150, 150, 5, 5);
g.drawString("1",230,40 );
g.drawString("2",270,90 );
g.drawString("4",270,220 );
g.drawString("5",230,270 );
g.drawString("8",20,220 );
g.drawString("7",70,270 );
g.drawString("11",50,45 );
g.drawString("10",15,95 );
g.drawRect(152, 150, 0, 120);
g.drawRect(152, 100, 0, 60);
}
public static void main(String[] args)
{
// You can change the title or size here if you want.
JFrame win = new JFrame("A Clock Face");
win.setSize(1024,768);
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
win.add( new AClockFace() );
win.setVisible(true);
}
}