import java.awt.*; import java.awt.event.*; import java.applet.Applet; public class Diagramm1 extends Applet implements ActionListener{ int pikkus1=150; int alaserv=300; TextField tf1=new TextField(String.valueOf(pikkus1)); public Diagramm1(){ add(tf1); tf1.addActionListener(this); } public void paint(Graphics g){ g.drawLine(50, alaserv, 50, alaserv-pikkus1); } public void actionPerformed(ActionEvent e){ pikkus1=Integer.parseInt(tf1.getText()); repaint(); } public static void main(String[] arg){ Frame f=new Frame("tulbad"); f.setSize(400, 400); f.add(new Diagramm1()); f.setVisible(true); } }