Nur die besten Spiele ;3
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
723 B

package Minesweeper;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class MinesweeperGame extends JPanel {
public MinesweeperGame(int _playfieldSize) {
this.setSize(600, 600);
setLayout(null);
initPlayfield(_playfieldSize);
}
private void initPlayfield(int _playfieldSize) {
for (int i = 0; i < _playfieldSize; i++) {
for (int j = 0; j < _playfieldSize; j++) {
JButton b = new JButton();
b.setBounds(j * 40, i * 40, 40, 40);
add(b);
}
}
}
public static void main(String[] args) {
JFrame f = new JFrame();
MinesweeperGame ttt = new MinesweeperGame(8);
f.add(ttt);
f.setSize(600, 600);
f.setLayout(null);
f.setVisible(true);
}
}