import java.awt.*; import java.awt.event.*; import java.applet.Applet; import java.io.*; import java.util.StringTokenizer; public class Hangman extends Applet implements ActionListener{ TextField tf=new TextField(); Button nupp=new Button(" OK "); Button nupp1=new Button(" UUS "); String sona=null; String arvatud = ""; int loendur=0; int loendur1=0; int pihtas=0; int moodas=0; int j=0; int suva=(int)Math.floor(10*Math.random()); boolean onpihtas; String sona1=null; public Hangman(){ add(tf); add(nupp); add(nupp1); nupp.addActionListener(this); nupp1.addActionListener(this); LoeFailistSona(); System.out.println(suva); System.out.println(sona); } public void LoeFailistSona() { try{ BufferedReader failist=new BufferedReader( new FileReader("sonad.txt") ); String rida=failist.readLine(); while(rida!=null){ loendur++; rida=failist.readLine(); if(loendur==suva){ sona=rida; } } failist.close(); }catch(Exception viga){ System.out.println("Probleem lugemisel"); } } public void actionPerformed(ActionEvent e){ if (e.getSource()==nupp){ onpihtas=false; for(int i=0; i