毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> java技术 >> 正文

小拼图游戏Exception in thread "main"java.lang.ArrayIndexOutofBoundsException

更新时间:2012-5-25:  来源:毕业论文

} }}
public void check(){
int checkNum=0;
for (int i = 0; i <level; i++) {
for(int j=0;j<level;j++){
if(XueButtonArray[i][j].getTileNumber().equals(""+(i*level+j)))
checkNum++; // check how many tiles are in the right position
}
}
if(checkNum==(level*level-1)){ // if all matches, open a window display congratulation message
int choiceEnd = JOptionPane.showConfirmDialog(null,"Would you like to Play again?","You have won!",JOptionPane.YES_NO_CANCEL_OPTION);
if (choiceEnd == JOptionPane.YES_OPTION){ // if user want to continue play a high level game
this.Xueframe.setVisible(false);
this.start();
}
if (choiceEnd == JOptionPane.NO_OPTION)
{
  }  
if (choiceEnd == JOptionPane.CANCEL_OPTION)
{
System.exit(0);
  } // if user want to quit

}
}

}


import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Font;
import java.awt.FontMetrics;

/**
 * A PuzzleTile class; this class inherits from JPanel.
 *
 * The tiles do not have any numbers painted on them yet.
 * The only indication you will be able to visibly see at this point
 * is that the 0 tile should be white and the rest gray.
 * 
 * @author Laurissa
 * @version 1.0
 * @author Paula
 * @version 1.1
 */

public class PuzzleTile extends JPanel {
  private String tileNumber;

  /**
  * This constructor takes in the number you would like
  * displayed on this panel and saves it as the String
  * instance variable tileNumber.
  * Note that you will still have to paint it onto the panel.
  * You should do that by overriding the method:
  * public void paintComponent(Graphics g){}.
  *
  * @param number The number to paint on the panel.
  */
public void paintComponent(Graphics g){
super.paintComponent(g);
Font myFont=new Font("Arial",Font.BOLD,30); // set font style

上一页  [1] [2] [3] 下一页

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。