1、import java.awt.BorderLayout;import java.awt.Container;import java.awt.Font;import java.awt.GridLayout;import java.awt.Insets;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import javax.swing.JButton;import j
2、avax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JMenu;import javax.swing.JMenuBar;import javax.swing.JMenuItem;import javax.swing.JPanel;import javax.swing.Timer;public class ScanLei1 extends JFrame implements ActionListenerprivate static final long serialVersionUID = 1L;private Conta
3、iner contentPane;private JButton btn;private JButton btns;private JLabel b1;private JLabel b2;private JLabel b3;private Timer timer;private int row=9;private int col=9;private int bon=10;private int a;private int b;private int a1;private JPanel p,p1,p2,p3;public ScanLei1(String title)super(title);co
4、ntentPane=getContentPane();setSize(297,377);this.setBounds(400, 100, 400, 500);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);timer =new Timer(1000,(ActionListener) this);a = new introw+2col+2;initGUI();public void initGUI()p3=new JPanel();b=bon;JMenuBar menuBar=new JMenuBar();JMenu menu1=new JMenu(
5、“游戏“);JMenu menu2=new JMenu(“帮助“);JMenuItem mi1=new JMenuItem(“初级“ );JMenuItem mi2 = new JMenuItem(“中级“ );JMenuItem mi3 =new JMenuItem(“高级“);mi1.addActionListener(this);menu1.add(mi1);mi2.addActionListener(this);menu1.add(mi2);mi3.addActionListener(this);menu1.add(mi3);menuBar.add(menu1);menuBar.add
6、(menu2);p3.add(menuBar);b1=new JLabel(bon+“);a1=new intbon;btn =new JButton(“开始“ );btn.addActionListener(this);b2=new JLabel(“0“);b3=new JLabel(“);btns=new JButtonrow*col;p=new JPanel();p.setLayout(new BorderLayout();contentPane.add(p);p.add(p3,BorderLayout.NORTH);/combo=new JComboBox(new Object“初级“
7、,“中级“,“高级“ );/加监听/*combo.addItemListener(new ItemListener();*/p1=new JPanel();/在那个位置/( FlowLayout)p1.getLayout().setAlignment( FlowLayout.RIGHT);p1.add(b1);p1.add(btn);p1.add(b2);p1.add(b3);p.add(p3,BorderLayout.NORTH);p.add(p1,BorderLayout.CENTER);p2=new JPanel();p2.setLayout(new GridLayout(row,col,0,0);for(int i=0;i-1if(n+col*q)=(m*col)elset+;b2.setText(t+“);for(int i=0;ibon)b1.setText(bon+“); elseb1.setText(b+“); btnsi.setEnabled(true);