部分功能实现:

     public void actionPerformed(ActionEvent ae) {
//重新开始按钮
if (ae.getSource().equals(anew)){
int i,k;
//重新排列每个棋子的位置
//黑色棋子 //车
for (i=0,k=24;i<2;i++,k+=456){
play[i].setBounds(k,56,55,55);
} //马
for (i=4,k=81;i<6;i++,k+=342){
play[i].setBounds(k,56,55,55);
} //相
for (i=8,k=138;i<10;i++,k+=228){
play[i].setBounds(k,56,55,55);
} //士
for (i=12,k=195;i<14;i++,k+=114){
play[i].setBounds(k,56,55,55);
} //卒
for (i=16,k=24;i<21;i++,k+=114){
play[i].setBounds(k,227,55,55);
} //炮
for (i=26,k=81;i<28;i++,k+=342){
play[i].setBounds(k,170,55,55);
} //将
play[30].setBounds(252,56,55,55); //红色棋子
//车
for (i=2,k=24;i<4;i++,k+=456){
play[i].setBounds(k,569,55,55);
} //马
for (i=6,k=81;i<8;i++,k+=342){
play[i].setBounds(k,569,55,55);
} //相
for (i=10,k=138;i<12;i++,k+=228){
play[i].setBounds(k,569,55,55);
} //士
for (i=14,k=195;i<16;i++,k+=114){
play[i].setBounds(k,569,55,55);
} //兵
for (i=21,k=24;i<26;i++,k+=114){
play[i].setBounds(k,398,55,55);
} //炮
for (i=28,k=81;i<30;i++,k+=342){
play[i].setBounds(k,455,55,55);
} //帅
play[31].setBounds(252,569,55,55); chessPlayClick = 2;
text.setText(" 红棋走棋"); for (i=0;i<32;i++){
play[i].setVisible(true);
}
//清除Vector中的内容
Var.clear(); } //悔棋按钮
else if (ae.getSource().equals(repent)){
try{
//获得setVisible属性值
String S = (String)Var.get(Var.size()-4);
//获得X坐标
int x = Integer.parseInt((String)Var.get(Var.size()-3));
//获得Y坐标
int y = Integer.parseInt((String)Var.get(Var.size()-2));
//获得索引
int M = Integer.parseInt((String)Var.get(Var.size()-1)); //赋给棋子
play[M].setVisible(true);
play[M].setBounds(x,y,55,55); if (play[M].getName().charAt(1) == '1'){
text.setText(" 黑棋走棋");
chessPlayClick = 1;
}
else{
text.setText(" 红棋走棋");
chessPlayClick = 2;
} //删除用过的坐标
Var.remove(Var.size()-4);
Var.remove(Var.size()-3);
Var.remove(Var.size()-2);
Var.remove(Var.size()-1); //停止旗子闪烁
chessManClick=false;
} catch(Exception e){
}
} //退出
else if (ae.getSource().equals(exit)){
int j=JOptionPane.showConfirmDialog(
this,"真的要退出吗?","退出",
JOptionPane.YES_OPTION,JOptionPane.QUESTION_MESSAGE); if (j == JOptionPane.YES_OPTION){
System.exit(0);
}
}
}

作业七:团队项目——Alpha版本冲刺阶段-11的更多相关文章

  1. 作业七:团队项目——Alpha版本冲刺阶段

      本次作业为期三周时间,要求各组结合所选项目并阅读教材<构建之法>第六章内容,完成项目的Alpha版本.本阶段的主要内容如下:(20分) 1. 每天组织一次站立会议,讨论每个成员的昨天进 ...

  2. 作业七:团队项目——Alpha版本冲刺阶段002

    今日进展:我们终于安装好了软件,今天开始进行作业设计. 今日安排:今天开始我们要开始我们的框架的设计.

  3. 作业七:团队项目——Alpha版本冲刺阶段-13

    对项目最后进行了完善. 代码如下: public void chapRule(int Man ,JLabel play,JLabel playTake,JLabel playQ[]){ //当前状态 ...

  4. 作业七:团队项目——Alpha版本冲刺阶段010

    今日安排:组内成员讨论 今日进程:组内成员讨论结束,并有明确的解决办法,每个人准备实践

  5. 作业七:团队项目——Alpha版本冲刺阶段009

    今日安排:组内成员讨论 今日进度:组内成员讨论分工细节以及可能遇到的问题,并提出解决方案

  6. 作业七:团队项目——Alpha版本冲刺阶段008

    今日进度:组内成员讨论 今日安排:组内成员分工

  7. 作业七:团队项目——Alpha版本冲刺阶段007

    今日进展:完善游戏主体代码. 今日安排:让游戏能运行起来.

  8. 作业七:团队项目——Alpha版本冲刺阶段006

    今日进展:完成主体代码. 今日安排:对程序主体进行编写.

  9. 作业七:团队项目——Alpha版本冲刺阶段005

    今日进展:编写代码. 今日安排:完成开始部分代码.

随机推荐

  1. Linux下的虚拟Bridge实现

    http://www.cnblogs.com/zmkeil/archive/2013/04/21/3034733.html Linux下的Bridge也是一种虚拟设备,这多少和vlan有点相似,它依赖 ...

  2. 在Xcode中使用Git进行源码版本控制

    http://www.cocoachina.com/ios/20140524/8536.html 资讯 论坛 代码 工具 招聘 CVP 外快 博客new 登录| 注册   iOS开发 Swift Ap ...

  3. 给angularJs的service建模

    先回顾一下我们遇到的问题: 通过一个dialogService创建对话框,并将该service的参数数据通过resolve的方式传递给对话框的controller. controller解析数据后放置 ...

  4. 日志——JSON的相关方法

    http://www.cnblogs.com/henryxu/archive/2013/03/10/2952738.html JSON  jar包: commons-lang.jar commons- ...

  5. Three ways to set specific DeviceFamily XAML Views in UWP

    Three ways to set specific DeviceFamily XAML Views in UWP http://igrali.com/2015/08/02/three-ways-to ...

  6. hadoop显示ConnectionrRefused

    产生原因重启了服务器 (1)在安装目录/root/cloud/hadoop-2.2.0/ 重新hdfs namenode -format (2) 目录/root/cloud/hadoop-2.2.0/ ...

  7. 通过硬编码获取dubbo服务对象

    运维进行监控dubbo服务的时候可能会调用dubbo服务对象,并且定期去执行,这时候如果需要添加新的服务,可能需要修改监控dubbo服务的配置,即dubbo-producer.xml或是dubbo-c ...

  8. gulp 配置自动化前端开发

    有的人说,grunt已经廉颇老矣,尚能饭否.gulp已经成为了未来的趋势,或许将撼动grunt的地位. 那么就得看看gulp到底优势在哪里,在我最近的使用中发现,我的到了一个结论:“grunt廉颇老矣 ...

  9. [UCSD白板题] Sorting: 3-Way Partition

    Problem Introduction The goal in this problem is to redesign a given implementation of the randomize ...

  10. (期望)A Dangerous Maze(Light OJ 1027)

    http://www.lightoj.com/volume_showproblem.php?problem=1027 You are in a maze; seeing n doors in fron ...