import java.awt.*; import java.awt.event.*; import java.io.*; public class Sovellusrunko { public static void main(String[] args) { Lomake Sovellus = new Lomake("Lomake"); } } class Lomake extends Frame implements ActionListener, WindowListener { TextArea alue; Button uusi; Lomake(String otsikko) { super(otsikko); setSize(400,300); setLayout(new FlowLayout()); add(uusi = new Button("Uusi")); add(alue = new TextArea(10,40)); uusi.addActionListener(this); addWindowListener(this); setVisible(true); } public void windowClosing(WindowEvent e) { System.exit(0); } public void windowClosed(WindowEvent e) {} public void windowDeiconified(WindowEvent e) {} public void windowIconified(WindowEvent e) {} public void windowActivated(WindowEvent e) {} public void windowDeactivated(WindowEvent e) {} public void windowOpened(WindowEvent e) {} public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Uusi")) { alue.selectAll(); alue.replaceText("",alue.getSelectionStart(),alue.getSelectionEnd()); } } }