import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class Kukkumine2 extends Applet implements Runnable, MouseListener{ double px=100; double py=100; double sammx=2; double sammy=0; double vajutusx, vajutusy; int pr=10; int tx=150; int ty=100; int tr=20; boolean tpihtas=false; boolean veel=true; public Kukkumine2(){ new Thread(this).start(); addMouseListener(this); } public void mousePressed(MouseEvent e){ sammx=0; sammy=0; vajutusx=e.getX(); vajutusy=e.getY(); } public void mouseReleased(MouseEvent e){ px=e.getX(); py=e.getY(); sammx=px-vajutusx; sammy=py-vajutusy; } public void mouseClicked(MouseEvent e){} public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){ tpihtas=false; repaint(); } public void paint(Graphics g){ g.drawOval((int)(px-pr), (int)(py-pr), 2*pr, 2*pr); if(tpihtas){ g.setColor(Color.red); } g.drawOval(tx-tr, ty-tr, 2*tr, 2*tr); } public void run(){ while(veel){ sammy=sammy+0.98; if(py+sammy