请问你能不能发给我一下Java单机版的别踩白块儿呢? 感激!不尽! 5
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)+提问者悬赏5(财富值+成长值)
1个回答
2015-05-14
展开全部
package 别踩白块;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JFrame;
public class Main extends JFrame implements MouseListener {
Block[] block=new Block[9];
Block1 block1=new Block1();
public Main(){
setTitle("别踩白块");
setBounds(200,300,200,300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new GridLayout(3,3,5,5));
addblock();
bk();
this.setVisible(true);
}
public void addblock(){
for(int i=0;i<9;i++)
{
block[i]=new Block();
add(block[i]);
}
}
public void bk(){
block1.setbk1(block[(int)(Math.random()*2)]);
block1.setbk1(block[(int)(Math.random()*2+4)]);
block1.setbk1(block[(int)(Math.random()*2+6)]);
}
public void over(){
block[3].setText("g");
block[4].setText("g");
block[5].setText("!");
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new Main();
}
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
if(e.getSource().equals(""));
over();
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询