import java.applet.Applet; import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.io.*; import java.util.StringTokenizer; public class punktid extends Applet implements ActionListener{ Button nupp=new Button(" Joonista punktid. "); public void init(){ add(nupp); nupp.addActionListener(this); } public void actionPerformed(ActionEvent e){ try{ BufferedReader sisse=new BufferedReader(new FileReader("punktid.txt")); String rida=sisse.readLine(); Graphics g = this.getGraphics(); g.setColor(Color.white); g.fillRect(0, 0, getSize().width, getSize().height); while(rida!=null){ StringTokenizer st=new StringTokenizer(rida, " "); while(st.hasMoreTokens()){ String sona=st.nextToken(); String sona1=st.nextToken(); int nr=Integer.parseInt(sona.trim()); int nr1=Integer.parseInt(sona1.trim()); g.setColor(Color.black); g.drawOval(nr, nr1, 10, 10); } rida=sisse.readLine(); } sisse.close(); } catch(Exception ex) {} } public static void main (String argumendid[]){ Frame f = new Frame("Rakendiraam"); f.setSize(300, 300); Applet ap = new punktid(); ap.init(); f.add(ap); f.setVisible(true); } }