关于java编程的扫雷程序 20
程序可以运行可以扫雷但是运行后会产生很多DOC而且在程序结束后会有很多命令提示符语句代码很长不知道可以贴上来不希望高手能留下QQ或者加我QQ63785127谢谢些impo...
程序可以运行 可以扫雷 但是运行后会产生很多DOC 而且在程序结束后会有很多命令提示符语句 代码很长 不知道可以贴上来不 希望高手能留下QQ 或者加我QQ63785127 谢谢些
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/*窗口及算法实现类*/
public class MainBomb extends JFrame implements ActionListener,MouseListener
{
public JTextField text;
public Label nowBomb,setBomb;
public int BlockNum,BombNum; //当前方块数当前雷数
public Icon icon_bomb = new ImageIcon("Bomb.gif"); //踩雷
public Icon icon_bomb_big = new ImageIcon("bomb_big.gif"); //踩雷标记
public Icon icon_flag = new ImageIcon("flag.gif"); //雷标记
public Icon icon_question = new ImageIcon("question.gif"); //疑惑是否有雷
public JButton start = new JButton(" 开始 ");
public Panel MenuPamel = new Panel();
public Panel mainPanel = new Panel();
public Bomb[][] bombButton;
/*界面设计*/
public MainBomb()
{
super("扫雷 小水桶之小灵子制作 2006.11 ");
// super.setSize(800, 600);
BlockNum = 64;
BombNum = 10;
Container c=getContentPane();
c.setBackground(Color.gray);
c.setLayout(new BorderLayout());
text=new JTextField("10 ",3);
nowBomb = new Label("当前雷数"+" "+BombNum+"");
setBomb= new Label("设置地雷数");
start.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
BombNum = Integer.parseInt(text.getText().trim());
if(BombNum >= 100 && BombNum < 200 )
replay();
else if(BombNum >= 50)
{
JOptionPane msg = new JOptionPane();
JOptionPane.showMessageDialog(null,"您设置的地雷数太多了,请重设!","错误",2);
}
if(BombNum < 10)
{
JOptionPane msg = new JOptionPane();
JOptionPane.showMessageDialog(null,"您设置的地雷数太少了,请重设!","错误",2);
}
}
} );
代码未贴完 展开
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/*窗口及算法实现类*/
public class MainBomb extends JFrame implements ActionListener,MouseListener
{
public JTextField text;
public Label nowBomb,setBomb;
public int BlockNum,BombNum; //当前方块数当前雷数
public Icon icon_bomb = new ImageIcon("Bomb.gif"); //踩雷
public Icon icon_bomb_big = new ImageIcon("bomb_big.gif"); //踩雷标记
public Icon icon_flag = new ImageIcon("flag.gif"); //雷标记
public Icon icon_question = new ImageIcon("question.gif"); //疑惑是否有雷
public JButton start = new JButton(" 开始 ");
public Panel MenuPamel = new Panel();
public Panel mainPanel = new Panel();
public Bomb[][] bombButton;
/*界面设计*/
public MainBomb()
{
super("扫雷 小水桶之小灵子制作 2006.11 ");
// super.setSize(800, 600);
BlockNum = 64;
BombNum = 10;
Container c=getContentPane();
c.setBackground(Color.gray);
c.setLayout(new BorderLayout());
text=new JTextField("10 ",3);
nowBomb = new Label("当前雷数"+" "+BombNum+"");
setBomb= new Label("设置地雷数");
start.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
BombNum = Integer.parseInt(text.getText().trim());
if(BombNum >= 100 && BombNum < 200 )
replay();
else if(BombNum >= 50)
{
JOptionPane msg = new JOptionPane();
JOptionPane.showMessageDialog(null,"您设置的地雷数太多了,请重设!","错误",2);
}
if(BombNum < 10)
{
JOptionPane msg = new JOptionPane();
JOptionPane.showMessageDialog(null,"您设置的地雷数太少了,请重设!","错误",2);
}
}
} );
代码未贴完 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询