-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoard.java
117 lines (103 loc) · 2.98 KB
/
Board.java
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//package Carromfinal;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseMotionAdapter;
import java.lang.Cloneable;
import javax.swing.*;
import java.awt.event.KeyListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.BasicStroke;
import java.awt.Point;
import java.util.Random;
class Board
{
/*int x= 35;
int y= 20;*/
int x=45;
int y=40;
/*int x=112;
int y=166;*/
int width=580;
int height=575;
public void draw(Graphics g)
{
Graphics2D g1=(Graphics2D)g;
Color cream=new Color(238,243,129);
g1.setColor(cream);
g1.fillRect(40,25,600,600);
Color brown= new Color(62,0,0);
g1.setColor(brown);
g1.drawRect(40,25,600,600);
g1.drawRect(39,24,600,600);
g1.drawRect(38,23,600,600);
g1.drawRect(41,26,600,600);
g1.drawRect(42,27,600,600);
g1.drawRect(37,22,600,600);
g1.drawRect(36,21,600,600);
g1.drawRect(35,20,600,600);
g1.drawRect(50,35,577,577);
g1.drawRect(49,34,579,579);
g1.drawRect(48,33,581,581);
g1.drawRect(47,32,583,583);
g1.drawRect(46,31,585,585);
g1.drawRect(45,30,587,587);
g1.drawRect(44,29,589,589);
g1.drawRect(43,28,591,591);
g1.drawRect(42,27,593,593);
g1.drawRect(41,26,595,595);
g1.drawRect(40,25,593,593);
g1.drawRect(39,24,595,595);
g1.drawRect(38,23,597,597);
g1.drawRect(37,22,599,599);
g1.setColor(Color.black);
//for drawing the four rectangles
g1.drawRect(158,91,362,25);
g1.drawRect(158,529,362,25);
g1.drawRect(112,141,25,362);
g1.drawRect(540,141,25,362);
Color maron=new Color(185,0,0);
g1.setColor(maron);
//for drawing the circles in the rectangles
g1.fillOval(110,131,30,30);
g1.fillOval(152,88,30,30);
g1.fillOval(497,88,30,30);
g1.fillOval(537,131,30,30);
g1.fillOval(537,487,30,30);
g1.fillOval(110,487,30,30);
g1.fillOval(152,527,30,30);
g1.fillOval(497,527,30,30);
//for drawing outlines
g1.setColor(Color.black);
g1.drawOval(110,131,30,30);
g1.drawOval(152,88,30,30);
g1.drawOval(497,88,30,30);
g1.drawOval(537,131,30,30);
g1.drawOval(537,487,30,30);
g1.drawOval(110,487,30,30);
g1.drawOval(152,527,30,30);
g1.drawOval(497,527,30,30);
//darkening one side of rectangles
g1.drawLine(158,90,520,90);
g1.drawLine(158,89,520,89);
g1.drawLine(111,141,111,503);
g1.drawLine(110,141,110,503);
g1.drawLine(566,141,566,503);
g1.drawLine(567,141,567,503);
g1.drawLine(158,555 ,520,555 );
g1.drawLine(158,556,520,556);
//center
g1.drawOval(259,245,140,140);
//Graphics2D g3=(Graphics2D)g;
g1.setColor(Color.black);
g1.fillOval(45,30,40,40);
g1.fillOval(592,30,40,40);
g1.fillOval(592,577,40,40);
g1.fillOval(45,577,40,40);
}
}