文档介绍:package weiqi;
import .*;
import .*;
import ;
public class Chess extends Frame
{
/**
*
*/
private static final long serialVersionUID = -6638650552294956227L;
ChessPad chesspad= new ChessPad();
Chess()
{
add(chesspad);
(70,90,440,440);
Label label=new Label("请先输入双方名称点击‘确认’点击‘开始’初始化游戏!",);
add(label);
(70,55,440,24);
();
addWindowListener
(
new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
(0);
}
}
);
setLayout(null);
setVisible(true);
setSize(600,550);
}
public static void main(String args[])
{
Chess chess=new Chess();
}
}
class ChessPad extends Panel implements MouseListener, ActionListener,FocusListener
{
int x = -1, y = -1, chessColor = 1;
String blackname="",whitename="";
Button button=new Button("开始");
Button inputButton=new Button("确认");
TextField text_1=new TextField("黑方执子"),
text_2=new TextField("白方执子"),//white please
text_3=new TextField("黑方名称"),
text_4=new TextField("白方名称");
ChessPad()
{
add(inputButton);
(35,5,60,26);
(this);
(this);
add(text_3);
(115,5,90,24);
(this);