import java.io.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.applet.Applet; public class Minesweeper extends Frame implements ActionListener,MouseListener,KeyListener{ Button[][] b=new Button[20][20]; boolean[][] klikitud=new boolean[20][20]; boolean[][] klikitud2=new boolean[20][20]; int[][] pommid=new int[25][2]; int n, m, mitupommi, mitu_klikitud; int x, y, voit, kaotus; int pommide_arv=5; int veergude_arv=10; int ridade_arv=10; static int laius, korgus; JTextField jtf=new JTextField(""); JTextField jtf1=new JTextField(""); JTextField jtf2=new JTextField(""); boolean lisa=true; public Minesweeper(){ try{ BufferedReader failist=new BufferedReader( new FileReader("stats.dat") ); voit=Integer.parseInt(failist.readLine()); kaotus=Integer.parseInt(failist.readLine()); failist.close(); }catch(Exception e){} laius=22*veergude_arv+8; korgus=18*ridade_arv+49; LoosiPommid(); Nupud(); Menyy(); Algseis(); } public void keyPressed(KeyEvent e){ /* int kood=e.getKeyCode(); //uus mäng if(kood==KeyEvent.VK_F2){ Algseis(); LoosiPommid(); } //pomme if(kood==KeyEvent.VK_F3){ Algseis(); PommideArv(); LoosiPommid(); } //veerge ridu if(kood==KeyEvent.VK_F4){ Algseis(); EemaldaNupud(); ReadVeerud(); Nupud(); validate(); LoosiPommid(); } //stats if(kood==KeyEvent.VK_F5){ Statistika(); } //välju if(kood==KeyEvent.VK_X){ Salvesta(); Lopetamine(); } */ } public void keyReleased(KeyEvent e){} public void keyTyped(KeyEvent e){} public void mousePressed(MouseEvent e){ for(int i=0;i20)veergude_arv=20; if(veergude_arv<10)veergude_arv=10; if(ridade_arv>20)ridade_arv=20; if(ridade_arv<10)ridade_arv=10; } public void PommideArv(){ jtf.setText(JOptionPane.showInputDialog("Sisesta, mitu pommi sa platsile tahad(5-25)")); try{ pommide_arv=Integer.parseInt(jtf.getText().trim()); }catch(Exception e){} if(pommide_arv>25)pommide_arv=25; if(pommide_arv<5)pommide_arv=5; } public void LoosiPommid(){ boolean uus=false; for(int i=0;i