import java.awt.*; import java.awt.event.*; public class DiaFuncts extends java.applet.Applet implements ActionListener { TextField tf; TextArea ta; Button bDraw; String stars = "*******************"; String spaces = " "; public void init() { tf = new TextField("Hello "); ta = new TextArea(20, 20); ta.setFont(new Font("Monospaced", Font.BOLD, 12)); bDraw = new Button("Draw"); bDraw.addActionListener(this); add(tf); add(bDraw); add(ta); } void Dia() { int k = 0; while (k < 10) { ta.append(spaces.substring(0,10-k) + stars.substring(0,2*k+1)+"\n"); k = k + 1; } } void Mond() { int k = 1; while (k < 10) { ta.append(spaces.substring(0,1+k) + stars.substring(0,19-2*k)+"\n"); k = k + 1; } } public void actionPerformed(ActionEvent event) { Object cause = event.getSource(); if (cause == bDraw) { tf.setText("Goodbye"); Dia(); Mond(); } } }