import java.awt.*; import java.awt.event.*; public class TekstiUuring extends java.applet.Applet implements ActionListener{ TextArea ta1=new TextArea(); TextArea ta2=new TextArea(); Button nupp1=new Button(); Button nupp2=new Button(); Button nupp3=new Button(); Button nupp4=new Button(); Button nupp5=new Button(); public TekstiUuring(){ setLayout(new BorderLayout()); Panel keskpaneel=new Panel(new GridLayout(1, 2)); Panel alapaneel =new Panel(new GridLayout(1, 5)); keskpaneel.add(ta1); keskpaneel.add(ta2); alapaneel.add(nupp1); alapaneel.add(nupp2); alapaneel.add(nupp3); alapaneel.add(nupp4); alapaneel.add(nupp5); add(keskpaneel, BorderLayout.CENTER); add(alapaneel, BorderLayout.SOUTH); nupp1.addActionListener(this); nupp2.addActionListener(this); nupp3.addActionListener(this); nupp4.addActionListener(this); nupp5.addActionListener(this); } public void actionPerformed(ActionEvent e){ String s=ta1.getText(); String vastus=""; if(e.getSource()==nupp1){ vastus="Tähtede arv: "+s.length()+ "\nLõpp: "+s.substring(s.length()-1)+ "\na asukoht: "+s.indexOf("a"); } if(e.getSource()==nupp2){ String[] m=s.split(" "); vastus="Sõnu: "+m.length+ "\nviimane: "+m[m.length-1]+ "\nviimased:"; StringBuffer puhver=new StringBuffer(); for(int i=0; i