import java.io.*; import java.awt.*; import java.awt.event.*; import java.applet.Applet; public class Trans extends Applet implements ActionListener { TextArea ylemineText = new TextArea("",8,5,1); TextArea alumineText = new TextArea("",8,5,1); Button Transleeri = new Button("Translate"); Button Salvesta = new Button("Salvesta"); Button Ava = new Button("Ava"); TextField failiNimi = new TextField("nimeta.txt"); public Trans() { Panel ylaOsa = new Panel(new GridLayout(2, 1)); //paneme kujunduse paika ylaOsa.add(ylemineText); ylaOsa.add(alumineText); Panel nuppudeOsa = new Panel(new GridLayout(1, 3)); nuppudeOsa.add(Transleeri); nuppudeOsa.add(Salvesta); nuppudeOsa.add(Ava); Transleeri.addActionListener(this); Salvesta.addActionListener(this); Ava.addActionListener(this); setLayout(new BorderLayout()); add(ylaOsa, BorderLayout.NORTH); add(failiNimi, BorderLayout.CENTER); add(nuppudeOsa, BorderLayout.SOUTH); ylemineText.setText("kas sulle tänane, kuidagi vilu võitu, ilm meeldib??"); } public String Analyys() { double teen = Math.random(); //suvaline arv 0-1 if (teen>0.9) return " camooon "; else if (teen>0.8) return " äääää "; else if(teen>0.7) return " :D:D:D "; else if (teen>0.6) return " eeeee..(A) "; else if(teen>0.5) return " ää..uu "; else if(teen>0.4) return " :D:D:D:D:D "; else if(teen>0.3) return " iccc "; return " "; } public void actionPerformed(ActionEvent e) { if(e.getSource()==Transleeri) { String transText = ylemineText.getText(); //String abi; alumineText.setText(""); for (int i=0; i