import java.applet.Applet; import java.awt.event.*; import java.awt.*; import java.util.Vector; public class kaal extends Applet implements MouseListener, ActionListener{ Graphics g; int x=160, y=40; int x2=180, y2=40; public kaal(){ addMouseListener(this); } public void paint(Graphics g){ //kaalu ylemine osa g.drawLine(50, 20, 100, 20); g.drawLine(55, 60, 95, 60); g.drawRect(55, 25, 40, 10); g.drawLine(50, 20, 55, 60); g.drawLine(100, 20, 95, 60); //kaalu alus g.drawRect(10, 70, 130, 30); //kaalujad g.drawRect(10, 55, 35, 5); g.drawRect(105, 55, 35, 5); // g.drawRect(x, y, 5, 15); } public void actionPerformed(ActionEvent e){} public void mousePressed(MouseEvent k){ x=k.getX(); x2=k.getX(); y=40; // if(x= if(x>=10&&x<=45||x>=105&&x<=140){ repaint(); }else{ x=160; repaint(); } } public void mouseReleased(MouseEvent k){} public void mouseClicked(MouseEvent k){} public void mouseEntered(MouseEvent k){} public void mouseExited(MouseEvent k){} public static void main(String argumendid[]){ Frame f=new Frame("Kaal"); f.add(new kaal()); f.setSize(300, 300); f.setVisible(true); } }