好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

java实现简单中国象棋

本文实例为大家分享了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

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

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

import java.awt.Canvas;

import java.awt.Color;

import java.awt.Font;

import java.awt.Graphics;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.event.MouseEvent;

import java.awt.event.MouseListener;

import java.awt.image.BufferedImage;

import java.util.Random;

import java.util.Stack;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JOptionPane;

public class Chinesechese extends Canvas implements MouseListener 

{

     class Record{

         int fromx,fromy,tox,toy,fromindex,toindex;

         Record( int fromx, int fromy, int tox, int toy, int fromindex, int toindex){

             this .fromx=fromx;    

             this .fromy=fromy;    

             this .tox=tox;    

             this .toy=toy;    

             this .fromindex=fromindex;    

             this .toindex=toindex;    

         }

     }

     int take_x=- 1 ,take_y=- 1 ,player= 0 ;

     boolean isRuning= true ;

     int table[][]= new int [ 10 ][ 11 ];

     String name[]= { "" , "将" , "仕" , "像" , "傌" , "俥" , "炮" , "卒" , "帅" , "士" , "相" , "马" , "车" , "炮" , "兵" };

     int value[]= { 0 , 1000 , 30 , 30 , 50 , 200 , 100 , 30 ,- 1000 ,- 30 ,- 30 ,- 50 ,- 200 ,- 100 ,- 30 };

     int init_table[]= { 0 , 5 , 4 , 3 , 2 , 1 , 2 , 3 , 4 , 5 };

     Random radom= new Random();

     BufferedImage map = new BufferedImage( 500 , 600 , BufferedImage.TYPE_INT_RGB);

     BufferedImage offScreenImage = new BufferedImage( 500 , 600 , BufferedImage.TYPE_INT_RGB);

     BufferedImage runImage = new BufferedImage( 500 , 600 , BufferedImage.TYPE_INT_RGB);

     Stack<Record> recordstk= new Stack<Record>();

     Chinesechese(){

         this .addMouseListener( this );

         this .setBounds( 150 , 0 , 500 , 600 );

         this .setBackground(Color.BLACK);

         Graphics g=map.getGraphics();

         g.setColor(Color.WHITE);

         g.fillRect( 0 , 0 , 500 , 570 );

         g.setColor(Color.black);

         g.setFont( new Font( "Dialog" , 0 , 35 ));

         g.drawString( " 楚河         汉界" , 130 , 285 );

         for ( int i= 0 ;i< 9 ;i++) {

             g.drawLine(i* 50 + 50 , 30 + 10 , i* 50 + 50 , 230 + 10 );

             g.drawLine(i* 50 + 50 , 300 + 10 , i* 50 + 50 , 500 + 10 );

         }

         for ( int i= 0 ;i< 5 ;i++)g.drawLine( 50 , 30 +i* 50 + 10 , 450 , 30 +i* 50 + 10 );

         for ( int i= 0 ;i< 5 ;i++)g.drawLine( 50 , 300 +i* 50 + 10 , 450 , 300 +i* 50 + 10 );

         g.drawLine( 50 , 230 , 50 , 330 );

         g.drawLine( 450 , 230 , 450 , 330 );

         g.drawLine( 200 ,   30 + 10 , 300 , 130 + 10 );

         g.drawLine( 200 , 130 + 10 , 300 ,   30 + 10 );

         g.drawLine( 200 , 400 + 10 , 300 , 500 + 10 );

         g.drawLine( 200 , 500 + 10 , 300 , 400 + 10 );

         for ( int i= 0 ;i< 10 ;i++)table[i][ 1 ]=init_table[i];

         for ( int i= 0 ;i< 10 ;i++)table[i][ 10 ]=init_table[i]+ 7 ;

         for ( int i= 1 ;i< 10 ;i+= 2 )table[i][ 4 ]= 7 ;

         for ( int i= 1 ;i< 10 ;i+= 2 )table[i][ 7 ]= 14 ;

         table[ 2 ][ 3 ]=table[ 8 ][ 3 ]= 6 ;

         table[ 2 ][ 8 ]=table[ 8 ][ 8 ]= 13 ;

         paintTable();

     }

 

     public void paint(Graphics g) {

         g.drawImage(offScreenImage, 0 , 0 , 500 , 600 , this );

     }

     void paintTable() {

         Graphics g=offScreenImage.getGraphics();

         g.drawImage(map, 0 , 0 , 500 , 600 , this );

         for ( int h= 1 ;h<= 10 ;h++)

           for ( int w= 1 ;w< 10 ;w++) 

         {

             if (table[w][h]== 0 ) continue ;

             if (h<= 5 ) {

                 g.setColor(Color.white);

                 g.fillArc(w* 50 - 25 , h* 50 - 35 , 50 , 50 , 0 , 360 );

                 if (table[w][h]<= 7 )g.setColor(Color.green);

                 else g.setColor(Color.red);

                 g.drawArc(w* 50 - 25 , h* 50 - 35 , 50 , 50 , 0 , 360 );

                 g.drawArc(w* 50 - 25 + 5 , h* 50 - 35 + 5 , 40 , 40 , 0 , 360 );

                 g.setFont( new Font( "Dialog" , 0 , 35 ));

                 g.drawString(name[table[w][h]], w* 50 - 18 , h* 50 + 2 );

             } else {

                 g.setColor(Color.white);

                 g.fillArc(w* 50 - 25 , h* 50 - 15 , 50 , 50 , 0 , 360 );

                 if (table[w][h]<= 7 )g.setColor(Color.green);

                 else g.setColor(Color.red);

                 g.drawArc(w* 50 - 25 , h* 50 - 15 , 50 , 50 , 0 , 360 );

                 g.drawArc(w* 50 - 20 , h* 50 - 10 , 40 , 40 , 0 , 360 );

                 g.setFont( new Font( "Dialog" , 0 , 35 ));

                 g.drawString(name[table[w][h]], w* 50 - 18 , h* 50 + 22 );

             }

         }        

     }

     void run( int startx, int starty, int endx, int endy, int index) {

         int k=Math.abs(endx-startx)* 5 +Math.abs(endy-starty)* 5 ;

         startx=startx* 50 - 25 ;

         if (starty<= 5 )starty=starty* 50 - 35 ;

         else starty=starty* 50 - 15 ;

         endx=endx* 50 - 25 ;

         if (endy<= 5 )endy=endy* 50 - 35 ;

         else endy=endy* 50 - 15 ;

         Graphics tg=runImage.getGraphics();

         Graphics g= this .getGraphics();

         paintTable();

         for ( int i= 1 ;i<=k;i++) 

         {

             try {

                 Thread.sleep( 10 );

             } catch (InterruptedException e) {

                 e.printStackTrace();

             }

             int x=(-startx+endx)/k*i+startx;

             int y=(-starty+endy)/k*i+starty;

             tg.drawImage(offScreenImage, 0 , 0 , 500 , 600 , this );

             tg.setColor(Color.white);

             tg.fillArc(x, y, 50 , 50 , 0 , 360 );

             if (index<= 7 )tg.setColor(Color.green);

             else tg.setColor(Color.red);

             tg.drawArc(x, y, 50 , 50 , 0 , 360 );

             tg.drawArc(x+ 5 , y+ 5 , 40 , 40 , 0 , 360 );

             tg.setFont( new Font( "Dialog" , 0 , 35 ));

             tg.drawString(name[index], x+ 7 , y+ 37 );

             g.drawImage(runImage, 0 , 0 , 500 , 600 , this );

         }

         int x=endx;

         int y=endy;

         tg.drawImage(offScreenImage, 0 , 0 , 500 , 600 , this );

         tg.setColor(Color.white);

         tg.fillArc(x, y, 50 , 50 , 0 , 360 );

         if (index<= 7 )tg.setColor(Color.green);

         else tg.setColor(Color.red);

         tg.drawArc(x, y, 50 , 50 , 0 , 360 );

         tg.drawArc(x+ 5 , y+ 5 , 40 , 40 , 0 , 360 );

         tg.setFont( new Font( "Dialog" , 0 , 35 ));

         tg.drawString(name[index], x+ 7 , y+ 37 );

         g.drawImage(runImage, 0 , 0 , 500 , 600 , this );

     }

     int getnum( int sx, int sy, int ex, int ey) {

         int cnt= 0 ,t;

         cnt-=(table[sx][sy]== 0 )? 0 : 1 ;

         cnt-=(table[ex][ey]== 0 )? 0 : 1 ;

         if (sx>ex) {t=sx;sx=ex;ex=t;}

         if (sy>ey) {t=sy;sy=ey;ey=t;}

         for ( int i=sx;i<=ex;i++)

             for ( int j=sy;j<=ey;j++)

                 cnt+=(table[i][j]== 0 )? 0 : 1 ;

         return cnt;

     }

     boolean canmove( int sx, int sy, int ex, int ey) {

         if (sx==ex&&sy==ey||table[sx][sy]== 0 ||table[ex][ey]!= 0 &&table[ex][ey]/ 8 ==table[sx][sy]/ 8 ) return false ;

         if (table[sx][sy]% 7 == 1 &&table[ex][ey]% 7 == 1 &&Math.abs(ex-sx)== 0 &&getnum(ex,ey,sx,sy)== 0 ) return true ;

         switch (table[sx][sy]) {

           case 1 : return ex> 3 &&ex< 7 &&ey< 4 &&Math.abs(ex-sx)+Math.abs(ey-sy)== 1 ;

           case 2 : return ex> 3 &&ex< 7 &&ey< 4 &&Math.abs(ex-sx)== 1 &&Math.abs(ey-sy)== 1 ;

           case 3 : return ey< 6 &&Math.abs(ex-sx)== 2 &&Math.abs(ey-sy)== 2 &&table[(ex+sx)/ 2 ][(sy+ey)/ 2 ]== 0 ;

           case 4 : return Math.abs(ex-sx)== 2 &&Math.abs(ey-sy)== 1 &&table[(ex+sx)/ 2 ][sy]== 0 ||

                         Math.abs(ex-sx)== 1 &&Math.abs(ey-sy)== 2 &&table[sx][(ey+sy)/ 2 ]== 0 ;

           case 5 : return (Math.abs(ex-sx)== 0 ||Math.abs(ey-sy)== 0 )&&getnum(ex,ey,sx,sy)== 0 ;

           case 6 : return (Math.abs(ex-sx)== 0 ||Math.abs(ey-sy)== 0 )&&

                         (table[ex][ey]!= 0 &&getnum(ex,ey,sx,sy)== 1 ||table[ex][ey]== 0 &&getnum(ex,ey,sx,sy)== 0 );

           case 7 : return ey< 6 &&Math.abs(ex-sx)== 0 &&ey-sy== 1 ||ey>= 6 &&Math.abs(ex-sx)+Math.abs(ey-sy)== 1 &&ey>=sy;

         }

         switch (table[sx][sy]- 7 ) {

           case 1 : return ex> 3 &&ex< 7 &&ey> 7 &&Math.abs(ex-sx)+Math.abs(ey-sy)== 1 ;

           case 2 : return ex> 3 &&ex< 7 &&ey> 7 &&Math.abs(ex-sx)== 1 &&Math.abs(ey-sy)== 1 ;

           case 3 : return ey> 5 &&Math.abs(ex-sx)== 2 &&Math.abs(ey-sy)== 2 &&table[(ex+sx)/ 2 ][(sy+ey)/ 2 ]== 0 ;

           case 4 : return Math.abs(ex-sx)== 2 &&Math.abs(ey-sy)== 1 &&table[(ex+sx)/ 2 ][sy]== 0 ||

                         Math.abs(ex-sx)== 1 &&Math.abs(ey-sy)== 2 &&table[sx][(ey+sy)/ 2 ]== 0 ;

           case 5 : return (Math.abs(ex-sx)== 0 ||Math.abs(ey-sy)== 0 )&&getnum(ex,ey,sx,sy)== 0 ;

           case 6 : return (Math.abs(ex-sx)== 0 ||Math.abs(ey-sy)== 0 )&&

                         (table[ex][ey]!= 0 &&getnum(ex,ey,sx,sy)== 1 ||table[ex][ey]== 0 &&getnum(ex,ey,sx,sy)== 0 );

           case 7 : return ey> 5 &&Math.abs(ex-sx)== 0 &&ey-sy==- 1 ||ey< 6 &&Math.abs(ex-sx)+Math.abs(ey-sy)== 1 &&ey<=sy;

         }

         return false ;

     }

     int AImovefour() {

         int re= 0 ;

         for ( int w= 1 ;w< 10 ;w++)

             for ( int h= 1 ;h< 11 ;h++) 

             if (table[w][h]> 7 )

             {

                 for ( int x= 1 ;x< 10 ;x++)

                     for ( int y= 1 ;y< 11 ;y++) 

                         if (canmove(w,h,x,y)) 

                         {

                             int t=table[x][y];

                             if (table[x][y]== 1 ) return - 3000 ;

                             int score=-value[t];

                             if (score<re) re=score;

                         }

             }

         return re;

     }

     int AImovethree() {

         int re=- 3000 ;

         for ( int w= 1 ;w< 10 ;w++)

             for ( int h= 1 ;h< 11 ;h++) 

             if (table[w][h]> 0 &&table[w][h]< 8 )

             {

                 for ( int x= 1 ;x< 10 ;x++)

                     for ( int y= 1 ;y< 11 ;y++) 

                         if (canmove(w,h,x,y)) 

                         {

                             if (table[x][y]== 8 ) return 3000 ;

                             int t=table[x][y];

                             table[x][y]=table[w][h];

                             table[w][h]= 0 ;

                             int score=-value[t]+AImovefour();

                             if (score>re&&score+value[t]!=- 3000 ) re=score;

                             table[w][h]=table[x][y];

                             table[x][y]=t;

                         }

             }

         return re;

     }

     int AImovetwo() {

         int re= 3000 ;

         for ( int w= 1 ;w< 10 ;w++)

             for ( int h= 1 ;h< 11 ;h++) 

             if (table[w][h]> 7 )

             {

                 for ( int x= 1 ;x< 10 ;x++)

                     for ( int y= 1 ;y< 11 ;y++) 

                         if (canmove(w,h,x,y)) 

                         {

                             if (table[x][y]== 1 ) return - 3000 ;

                             int t=table[x][y];

                             table[x][y]=table[w][h];

                             table[w][h]= 0 ;

                             int score=-value[t]+AImovethree();

                             if (score<re&&score+value[t]!= 3000 ) re=score;

                             table[w][h]=table[x][y];

                             table[x][y]=t;

                         }

             }

         return re;

     }

     void AImove() {

         int take_x= 0 ,take_y= 0 ,q_x= 0 ,q_y= 0 ,maxval=- 3000 ;

         int flag= 0 ;

         for ( int w= 1 ;w< 10 ;w++) {

             for ( int h= 1 ;h< 11 ;h++) 

             if (table[w][h]> 0 &&table[w][h]< 8 )

             {

                 for ( int x= 1 ;x< 10 ;x++) {

                     for ( int y= 1 ;y< 11 ;y++) 

                         if (canmove(w,h,x,y)) 

                         {

                             int movenum= 0 ;

                             for ( int i= 1 ;i< 10 ;i++)

                                 for ( int j= 1 ;j< 11 ;j++)

                                     if (canmove(w,h,i,j))

                                         movenum-=value[table[i][j]]/ 10 + 1 ;

                             int t=table[x][y];

                             table[x][y]=table[w][h];

                             table[w][h]= 0 ;

                             int score=-value[t]+AImovetwo();

                             table[w][h]=table[x][y];

                             table[x][y]=t;

                             for ( int i= 1 ;i< 10 ;i++)

                                 for ( int j= 1 ;j< 11 ;j++)

                                     if (canmove(x,y,i,j))

                                         movenum+=value[table[i][j]]/ 10 + 1 ;

                             if (score+movenum>=maxval&&score+value[t]!=- 3000 ) {

                                 if (score+movenum>maxval||radom.nextBoolean()) {

                                     maxval=score+movenum;

                                     take_x=w;

                                     take_y=h;

                                     q_x=x;

                                     q_y=y;                                

                                 }

                             }                            

                             if (t== 8 ) 

                             {

                                 maxval= 3000 ;

                                 flag= 1 ;

                                 take_x=w;

                                 take_y=h;

                                 q_x=x;

                                 q_y=y;

                                 break ;

                             }

                            

                         }

                     if (flag== 1 ) break ;

                 }

                 if (flag== 1 ) break ;

             }    

             if (flag== 1 ) break ;

         }    

         if (maxval<=- 3000 ) {

             JOptionPane.showMessageDialog( null , "你赢了" );

             isRuning= false ;

         } else {

             if (maxval>= 3000 ) {

                 JOptionPane.showMessageDialog( null , "你输了" );

                 isRuning= false ;

             }

             int index=table[take_x][take_y];

             table[take_x][take_y]= 0 ;

             recordstk.push( new Record(take_x,take_y,q_x,q_y,index,table[q_x][q_y]));

             run(take_x,take_y,q_x,q_y,index);

             table[q_x][q_y]=index;

             paintTable();

         }

     }

     public static void main(String[] args) {

         JFrame gameFrame= new JFrame( "中国象棋" );

         JButton regame= new JButton( "重新开始" );

         JButton retake= new JButton( "悔棋" );

         JButton complay= new JButton( "电脑出手" );

         Chinesechese chinesechese= new Chinesechese();

         retake.addActionListener( new ActionListener() {

             public void actionPerformed(ActionEvent e) {

                

                 if (chinesechese.recordstk.empty())JOptionPane.showMessageDialog( null , "无法再次悔棋" );

                 else {

                     for ( int i= 0 ;i< 2 ;i++) {

                         Chinesechese.Record record=chinesechese.recordstk.pop();

                         chinesechese.table[record.tox][record.toy]=record.toindex;

                         chinesechese.paintTable();

                         chinesechese.run(record.tox, record.toy, record.fromx,record.fromy,record.fromindex);

                         chinesechese.table[record.fromx][record.fromy]=record.fromindex;

                         chinesechese.take_x=chinesechese.take_y=- 1 ;

                         chinesechese.paintTable();

                         chinesechese.repaint();    

                     }

 

                 }

             }

         });

         regame.addActionListener( new ActionListener() {

             public void actionPerformed(ActionEvent e) {

                 while (chinesechese.recordstk.empty()== false ) {

                     Chinesechese.Record record=chinesechese.recordstk.pop();

                     chinesechese.table[record.tox][record.toy]=record.toindex;

                     chinesechese.paintTable();

                     chinesechese.run(record.tox, record.toy, record.fromx,record.fromy,record.fromindex);

                     chinesechese.table[record.fromx][record.fromy]=record.fromindex;

                     chinesechese.take_x=chinesechese.take_y=- 1 ;

                     chinesechese.paintTable();

                     chinesechese.repaint();

                 }

                 chinesechese.isRuning= true ;

             }

         });

         complay.addActionListener( new ActionListener() {

             public void actionPerformed(ActionEvent e) {

                 chinesechese.AImove();

             }

         });

         regame.setBounds( 670 , 450 , 100 , 50 );

         retake.setBounds( 670 , 350 , 100 , 50 );

         complay.setBounds( 670 , 250 , 100 , 50 );

         gameFrame.setBounds( 100 , 100 , 800 , 600 );

         gameFrame.setLayout( null );

         gameFrame.add(chinesechese);

         gameFrame.add(regame);

         gameFrame.add(retake);

         gameFrame.add(complay);

         gameFrame.setVisible( true );

         gameFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

     }

     public void mouseClicked(MouseEvent e) {

         // TODO Auto-generated method stub

        

     }

     @Override

     public void mousePressed(MouseEvent e) {

         int x=e.getX();

         int y=e.getY();

         int q_x=- 1 ,q_y=- 1 ;

         if (y<= 265 ) {

             q_y=(y+ 35 )/ 50 ;

             q_x=(x+ 25 )/ 50 ;

         }

         if (y>= 285 )

         {

             q_y=(y+ 15 )/ 50 ;

             q_x=(x+ 25 )/ 50 ;

         }

         if (q_x> 9 ||q_y> 10 ||q_x< 1 ||q_y< 1 ) {

             q_x=- 1 ;

             q_y=- 1 ;

         }

         if (q_x!=- 1 &&q_y!=- 1 &&isRuning) 

         {

             if (take_x!=- 1 ) 

             {

                 if (table[take_x][take_y]> 0 &&canmove(take_x,take_y,q_x,q_y)) {

                     int index=table[take_x][take_y];

                     table[take_x][take_y]= 0 ;

                     recordstk.push( new Record(take_x,take_y,q_x,q_y,index,table[q_x][q_y]));

                     run(take_x,take_y,q_x,q_y,index);

                     take_x=- 1 ;take_y=- 1 ;

                     table[q_x][q_y]=index;

                     Graphics g= this .getGraphics();

                     g.fillRect( 100 , 220 , 300 , 100 );

                     g.setColor(Color.green);

                     g.setFont( new Font( "Dialog" , 0 , 35 ));

                     g.drawString( " 等待绿方下棋 " , 130 , 285 );

                     paintTable();

                     AImove();

                 }

                 else

                 {

                     take_x=- 1 ;take_y=- 1 ;

                     paintTable();

                     repaint();

                 }

             }

             else

             if (table[q_x][q_y]!= 0 &&take_x==- 1 ) {

                 take_x=q_x;

                 take_y=q_y;        

                 Graphics g=offScreenImage.getGraphics();

                 g.setColor(Color.BLACK);

                 if (take_y<= 5 )g.drawRect(take_x* 50 - 25 , take_y* 50 - 35 , 50 , 50 );

                 else g.drawRect(take_x* 50 - 25 , take_y* 50 - 15 , 50 , 50 );

                 g.setColor(Color.gray);

                 for ( int w= 1 ;w< 10 ;w++)

                     for ( int h= 1 ;h< 11 ;h++) {

                         if (canmove(take_x,take_y,w,h)) {

                             if (h<= 5 )g.drawRect(w* 50 - 20 , h* 50 - 30 , 40 , 40 );

                             else g.drawRect(w* 50 - 20 , h* 50 - 10 , 40 , 40 );

                         }

                     }

                 repaint();

             }

            

         }

     }

     public void mouseReleased(MouseEvent e) {

         // TODO Auto-generated method stub

        

     }

     public void mouseEntered(MouseEvent e) {

         // TODO Auto-generated method stub

        

     }

     public void mouseExited(MouseEvent e) {

         // TODO Auto-generated method stub

        

     }

}

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

原文链接:https://blog.csdn.net/qq_40708167/article/details/106182627

查看更多关于java实现简单中国象棋的详细内容...

  阅读:21次