-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHuman.java
More file actions
148 lines (106 loc) · 4.33 KB
/
Copy pathHuman.java
File metadata and controls
148 lines (106 loc) · 4.33 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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class Human extends Player
{
public Human(Color c, String s)
{
super(c,s);
}
public void destroy()
{
}
@Override
public String getRevivalCandidate()
{
{
/**
* all subclass override this method to return the variable revival
* only human player will do the below thing
*
*/
Image goties[]=null;
if(this.team.equals(goti.colWhit))
{
goties=new Image[]{game.whitQueen,game.whitRook,game.whitNait,game.whitBishop};
}
else
{
goties=new Image[]{game.blakQueen,game.blakRook,game.blakNait,game.blakBishop};
}
Promotion dialog=new Promotion(gui.frame,goties,MouseInfo.getPointerInfo().getLocation());//dialog appears where mouse pointer is
return dialog.run();
}
}
public JComponent getMouseEventCauser()
{
return game.getChessBoard().pan;
}
public static JPanel getEntryMenu(JFrame container)
{
JPanel local=new utility.GradientPanel();
local.setOpaque(true);
local.setLayout(null);
Font font=new Font("",Font.PLAIN,22);
Font font2=new Font("",Font.PLAIN,18);
local.setBorder(BorderFactory.createTitledBorder("Two player"));
JLabel lab=new JLabel("Name of the white team player");
lab.setBounds(10,10,500,40);
lab.setFont(font);
JTextField whi=new JTextField("");
whi.setFont(font2);
whi.setBounds(10,46,250,40);
JLabel n=new JLabel("Name of the black team player");
n.setBounds(10,90,500,50);
n.setFont(font);
JTextField bla=new JTextField("");
bla.setBounds(10,158-22,250,40);
bla.setFont(font2);
utility.rgbButton proc=new utility.rgbButton("Start game");
proc.setForeground(Color.black.darker());
proc.setBounds(2,250,container.getWidth()-5,119);
proc.setFont(new Font("",Font.PLAIN,35));
proc.setFocusable(false);
proc.setOpaque(false);
JToggleButton grab=new JToggleButton("Record this game");
grab.setBounds(10,200,150,30);
grab.setOpaque(false);
grab.setFocusable(false);
JComboBox<String> jcb=new JComboBox<String>(TimeType.times);
jcb.setBounds(190,200,120,30);
local.add(grab);
local.add(proc);
local.add(jcb);
local.add(n);
local.add(bla);
local.add(whi);
local.add(lab);
MouseAdapter mouse=new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
String w=whi.getText();
if(w.equals(""))
w="player1";
String b=bla.getText();
if(b.equals(""))
b="player2";
Thread gt=new utility.fadeout(container,false,false);
gt.start();
entryPoint.disableAllOptions();
proc.setEnabled(false);
Human white=new Human(goti.colWhit,w);
Human black=new Human(goti.colBlak,b);
new game(new Player[]{white,black},new Object[]{0,grab.getModel().isSelected()});
}
};
proc.addMouseListener(mouse);
return local;
}
@Override
public void playMove() {
}
@Override
public void endMove() {
}
}