用java做一个拼图游戏数字的,4*4 有一个空格求帮忙

已有模板和图片求大神帮忙填充比较急code大部分都没写:importjavax.swing.*;importjava.awt.*;importjava.awt.event... 已有模板和图片求大神帮忙填充比较急 code大部分都没写:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.Math;

public class PuzzleStartingPoint implements MouseListener
{
Drawing draw = new Drawing();
int [][] board = {{1,2,3,4}, //4X4 puzzle board
{5,6,7,8}, //0 is the blank spot
{9,10,11,12},
{13,14,15,0}};
ImageIcon[] boardPictures = new ImageIcon[16]; //stores the 16 tile pictures
int blankRow, blankCol;

public PuzzleStartingPoint() // constructor
{
for (int i = 0; i < boardPictures.length; i++)
boardPictures[i] = new ImageIcon(i + ".jpg");
JFrame frame = new JFrame("Puzzle");
frame.add(draw);
draw.addMouseListener(this);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(420, 440);
initializeBoard();
frame.setVisible(true);
}

// gets the 4X4 puzzle board ready to play
public void initializeBoard()
{

} // initializeBoard

// finds a blank spot and picks a tile randomly to move into it
public void shuffleBoard()
{

} // shuffleBoard

// finds where the blank spot is and stores its row and column into blankRow and blankCol
public void findBlank()
{

} // findBlank

// moves the chosen (mouse-clicked) tile into a blank spot if possible
public void moveTile(int row, int col)
{

} // moveTile

class Drawing extends JComponent
{
public void paint(Graphics g)
{
for (int row = 0; row < 4; row++)
for (int col = 0; col < 4; col++)
g.drawImage(boardPictures[board[row][col]].getImage(),col * 100, row * 100,100,100,this);
}
}

// --> starting implementing MouseListener - it has 5 methods
public void mousePressed(MouseEvent e)
{
}

public void mouseReleased(MouseEvent e)
{
// find coords of mouse click
int row = e.getY()/100;
int col = e.getX()/100;

moveTile(row, col);

// get paint to be called to reflect your mouse work
draw.repaint();
}

public void mouseClicked(MouseEvent e)
{
}

public void mouseEntered(MouseEvent e)
{
}

public void mouseExited(MouseEvent e)
{
}
// finishing implementing MouseListener <---
public static void main(String[] args)
{
new PuzzleStartingPoint();
}
}
nono
展开
 我来答
laobaitu0322
2014-12-03 · TA获得超过744个赞
知道小有建树答主
回答量:900
采纳率:33%
帮助的人:647万
展开全部
用你的模板写还不如重写一个比较快。。。。
追问
不行啊,老师给了模板,求大神帮忙
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
清花莲瓷
2014-12-04 · TA获得超过814个赞
知道答主
回答量:86
采纳率:0%
帮助的人:32.5万
展开全部
eeeeeeee e e
e e e
eeeeeeee e e
e e e
eeeeeeee
追问
求不水
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
匿名用户
2014-12-16
展开全部
已发送给你邮箱
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式