import java.io.*; import java.awt.*; import java.text.*; import java.util.*; import java.awt.event.*; import java.applet.Applet; public class TekstiPakkija extends Applet implements ActionListener, TextListener{ Button nupp1=new Button("Paki ümber"); Button nupp2=new Button("Loe andmed"); TextArea ta=new TextArea(""); TextField tf3=new TextField(""); TextField tf2=new TextField(15); TextField tf=new TextField(""); String tekst2; String nimi="fail.txt"; public TekstiPakkija(){ tf.setText(nimi); setLayout(new BorderLayout()); Panel p=new Panel(new GridLayout(1, 2)); p.add(nupp1); nupp1.addActionListener(this); p.add(nupp2); nupp2.addActionListener(this); add(p, BorderLayout.NORTH); add(ta, BorderLayout.CENTER); ta.addTextListener(this); add(tf2, BorderLayout.EAST); Panel p2=new Panel(new GridLayout(2,1)); p2.add(tf); p2.add(tf3); add(p2, BorderLayout.SOUTH); tf.addActionListener(this); } public void textValueChanged(TextEvent e){ String koik=ta.getText(); tf2.setText(koik.length()+" tähte"); try{ String s = ta.getText(); int loe=1; tf3.setText(""); for(int i=0;i