900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > 用java编写人机围棋游戏_JAVA写的围棋游戏的源代码.doc

用java编写人机围棋游戏_JAVA写的围棋游戏的源代码.doc

时间:2018-10-23 12:04:35

相关推荐

用java编写人机围棋游戏_JAVA写的围棋游戏的源代码.doc

JAVA写的围棋游戏的源代码

JavaD′μ??§??ó??·μ??′′ú??.txt?òμ?è?éúóDA ??ò2óDB??£???μ?è?éúóDS??ò2óDB???£ ꧰ü2??é??£?1??ü?′ê?2?ê?3é1|???è?£???úμ?′ó?§éúì??????êá?£?1yà′??????£??óè?ó????D£?óD???§·???襣??àoó????o??1ò2????21á?éú?°?ò2??eo?·?μ?ò?o??£import java.awt.*;

import java.awt.event.*;

import javax.swing.JOptionPane;

public class Chess extends Frame

{

ChessPad chesspad= new ChessPad();

Chess()

{

add(chesspad);

chesspad.setBounds(70,90,440,440);

Label label=new Label("click to point,doubled_click to remove,right click to back",Label.CENTER);

add(label);

label.setBounds(70,55,440,24);

label.setBackground(Color.orange);

addWindowListener

(

new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

System.exit(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("start");

Button inputButton=new Button("input");

TextField text_1=new TextField("black please"),

text_2=new TextField(""),//white please

text_3=new TextField("black'name"),

text_4=new TextField("white'name");

ChessPad()

{

add(inputButton);

inputButton.setBounds(35,5,60,26);

inputButton.addActionListener(this);

inputButton.addFocusListener(this);

add(text_3);

text_3.setBounds(115,5,90,24);

text_3.addFocusListener(this);

text_3.setEditable(true);

add(text_4);

text_4.setBounds(315,5,90,24);

text_4.addFocusListener(this);

text_4.setEditable(true);

add(button);

button.setBounds(35,36,60,26);

button.setEnabled(false);

button.addActionListener(this);

add(text_1);

text_1.setBounds(115,36,90,24);

text_1.setEnabled(false);

text_1.setEditable(false);

add(text_2);

text_2.setBounds(315,36,90,24);

text_2.setEnabled(false);

text_

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。