import javax.swing.Action; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.JToggleButton; import javax.swing.JToolBar;
public class Minesweeper extends JFrame {
private int coloane = 10; private int linii = 10; private static final long serialVersionUID = 1L;
// arata care casute sunt bombe si care nu. boolean jBombs[][] = new boolean[linii][coloane];
// arata care casute au fost descoperite. boolean jShown[][] = new boolean[linii][coloane];
// informatii despre casutele inconjuratoare. int jCells[][] = new int[linii][coloane]; private int currX, currY = 0; JToggleButton jButtons[] = new JToggleButton[coloane*linii]; private JPanel jPanel = null; private JToolBar jToolBar = null; private JPanel jContentPane = null; private JButton jBtnNewGame = null; private JButton jBtnSave = null; private JButton jBtnReluare = null; private JProgressBar jProgressBar = null; int bombsCount = 0; int ToateBifate = 0; //constructor public Minesweeper() { super(); initialize(); }
private void initialize() { this.setSize(500, 550); this.setContentPane(getJPanel()); this.setTitle("Minesweeper"); this.setVisible(true); } private JPanel getJPanel() { if (jPanel == null) { jPanel = new JPanel(); jPanel.setLayout(new BorderLayout()); jPanel.add(getJToolBar(), BorderLayout.NORTH); jPanel.add(getJContentPane(), BorderLayout.CENTER); jPanel.add(getJProgressBar(), BorderLayout.SOUTH); } return jPanel; }
private JToolBar getJToolBar() { if (jToolBar == null) {