import java.awt.*; import java.awt.event.*; import java.applet.Applet; public class joonistapastakas3 extends Applet implements ActionListener{ TextField tfKorgus=new TextField("250",5); Button nupp=new Button("Joonista"); public joonistapastakas3(){ add(tfKorgus); add(nupp); nupp.addActionListener(this); } public void paint(Graphics g){ int kogus=Integer.parseInt(tfKorgus.getText()); int pastakaKorgus=kogus; g.setColor(new Color(200, 100, 100)); g.setColor(Color.black); g.drawLine(25, 100, 25, pastakaKorgus); g.drawLine(45, 100, 45, pastakaKorgus); g.drawLine(25, pastakaKorgus, 45, pastakaKorgus); g.drawLine(25, 100, 30, 80); g.drawLine(45, 100, 40, 80); g.drawLine(30, 80, 40, 80); g.drawLine(35, 80, 35, 70); } public void actionPerformed(ActionEvent e){ repaint(); } public static void main(String argumendid[]){ Frame f=new Frame("joonistapastakas3"); f.setSize(200, 500); f.add(new joonistapastakas3()); f.setVisible(true); } }