import java.awt.*; import java.awt.event.*; import java.applet.Applet; import java.applet.*; public class Mandoliin extends Applet implements ActionListener, MouseListener, MouseMotionListener{ int nr=3; int nr2=20; int x=60; int y=20; TextField tf1=new TextField("3"); TextField tf2=new TextField("20"); public Mandoliin(){ addMouseListener(this); add(tf1); add(tf2); tf1.addActionListener(this); tf2.addActionListener(this); } public void paint(Graphics g){ if(nr2<=15){ nr2=16; } if(nr2>=40){ nr2=39; } g.drawRect(50+(40-nr2)/2, 70, nr2, 60); g.drawLine(65, 70, 65, 200); g.drawLine(75, 70, 75, 200); g.drawLine(68, 70, 68, 200); g.drawLine(72, 70, 72, 200); g.drawRect(50, 50, 40, 20); g.drawOval(36, 130, 70, 70); g.drawOval(62, 145, 15, 15); g.drawLine(55, 180, 85, 180); g.drawLine(40, 55, 50, 55); g.drawLine(40, 60, 50, 60); g.drawLine(40, 65, 50, 65); g.drawLine(90, 55, 100, 55); g.drawLine(90, 60, 100, 60); g.drawLine(90, 65, 100, 65); for(int i=0; i11){ nr=11; } g.drawLine(50+(40-nr2)/2, 75+5*i, (50+(40-nr2)/2)+nr2, 75+5*i); } } public void actionPerformed(ActionEvent e){ nr=Integer.parseInt(tf1.getText().trim()); repaint(); nr2=Integer.parseInt(tf2.getText().trim()); repaint(); } public void mouseDragged(MouseEvent e){} public void mouseMoved(MouseEvent e){} public void mousePressed(MouseEvent e){} public void mouseReleased(MouseEvent e){} public void mouseClicked(MouseEvent e){} public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){} public static void main(String[] argumendid){ Frame f=new Frame(); f.add(new Mandoliin()); f.setSize(300, 300); f.setVisible(true); } }