haode 大哥: 帮忙帮到底,能不能看看第二个。以下是部分源码:(一个五子棋的客妇端, public void mouseClicked(MouseEvent me) { if(started==false)return; if(me.getSource()==back) { started=false;//specify connection finished Point p=getPoint(me.getX(),me.getY()); if(p.x==0)return;//point out that the position is wrong back.drawChess (p);//will drawLine and drawImage(mainly means chess) System.out.println("I have drawed ,do you look it?");//debug inf.status=Information.PLAY;//Information is a class ,you will //see it later. inf.chessPosition=p; try { out.writeObject (inf); inf=(Information)in.readObject System.out.println ("now i have read from socket"); } catch(Exception exc){tp.setInformation (""+exc);} //many to add ; back.drawChess (p); System.out.println("I have drawed again,do you look it if(inf.status==Information.PLAY) { back.drawChess(inf.chessPosition); int i=inf.chessPosition.y-1; int j=inf.chessPosition.x-1; occupied[i][j]=true; } started=true; } }//the class Information is: class Information extends Object implements Serializable { static final int OVERLOAD=1,OK=2,ABORTION=3,WAIT=4,PLAY=5,CONNECT=6,PREPARED=7,HUIQI=8; int status; Point chessPosition;
public Information(final int sts,Point p) { status=sts; chessPosition=p; } } help,help?
帮忙帮到底,能不能看看第二个。以下是部分源码:(一个五子棋的客妇端,
public void mouseClicked(MouseEvent me)
{
if(started==false)return;
if(me.getSource()==back)
{
started=false;//specify connection finished
Point p=getPoint(me.getX(),me.getY());
if(p.x==0)return;//point out that the position is wrong
back.drawChess (p);//will drawLine and drawImage(mainly means chess)
System.out.println("I have drawed ,do you look it?");//debug
inf.status=Information.PLAY;//Information is a class ,you will
//see it later.
inf.chessPosition=p;
try
{
out.writeObject (inf);
inf=(Information)in.readObject
System.out.println ("now i have read from socket");
}
catch(Exception exc){tp.setInformation (""+exc);}
//many to add ;
back.drawChess (p);
System.out.println("I have drawed again,do you look it
if(inf.status==Information.PLAY)
{
back.drawChess(inf.chessPosition);
int i=inf.chessPosition.y-1;
int j=inf.chessPosition.x-1;
occupied[i][j]=true;
}
started=true;
}
}//the class Information is:
class Information extends Object implements Serializable
{
static final int OVERLOAD=1,OK=2,ABORTION=3,WAIT=4,PLAY=5,CONNECT=6,PREPARED=7,HUIQI=8;
int status;
Point chessPosition;
public Information(final int sts,Point p)
{
status=sts;
chessPosition=p;
}
}
help,help?