import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class Muur extends Applet implements ActionListener{ TextField tf=new TextField("4"); public Muur(){ add(tf); tf.addActionListener(this);//textboxi värk } public void paint(Graphics g){ int arv=Integer.parseInt(tf.getText().trim()); int nr=1; int a=30;//ühe rea kõrgus g.drawLine(0,150,400,150); g.drawLine(0,150,50,110); g.drawLine(50,110,100,150); g.drawLine(100,150,150,110); g.drawLine(150,110,200,150); g.drawLine(200,150,250,110); g.drawLine(250,110,300,150); g.drawLine(300,150,350,110); g.drawLine(350,110,400,150); g.drawRect(40,200+arv*30,50,50);//kuudi algus g.drawLine(30,215+arv*30,65,170+arv*30); g.drawLine(65,170+arv*30,100,215+arv*30); g.drawOval(50,210+arv*30,30,30); g.drawLine(120,225+arv*30,190,225+arv*30);//noole algus g.drawLine(120,225+arv*30,135,215+arv*30); g.drawLine(120,225+arv*30,135,235+arv*30); g.setColor(Color.blue); g.drawString("Mitu rida plokke majale tahad?",10,20); g.drawString("See on minu koera kuut!",200,225+arv*30); g.setColor(Color.black); while(nr<=arv){ g.drawRect(0,120+a,80,30); g.drawRect(80,120+a,80,30); g.drawRect(160,120+a,80,30); g.drawRect(240,120+a,80,30); g.drawRect(320,120+a,80,30); nr=nr+1; a=a+30; } } public void actionPerformed(ActionEvent e){ repaint(); } public static void main(String argumendid[]){ Frame f=new Frame(""); f.add(new Muur()); f.setSize (410, 500); f.setVisible (true); } }