import java.awt.*; import java.awt.event.*; import java.applet.Applet; import java.util.LinkedList; public class KukkuvPall3 extends Applet implements MouseListener, Runnable{ int r=10; double koef=10; //10 punkti=1 meeter int maapind=200; LinkedList pallid=new LinkedList(); int ex(double ox){ return (int)(ox*koef); } int ey(double oy){ return (int)(maapind-oy*koef); } double ox(int ex){ return ex/koef; } double oy(int ey){ return (maapind-ey)/koef; } public KukkuvPall3(){ addMouseListener(this); new Thread(this).start(); } public void paint(Graphics g){ Image pilt=createImage(getWidth(), getHeight()); Graphics piltg=pilt.getGraphics(); for(int i=0; i2){ repaint(); try{Thread.sleep(100);}catch(Exception e){} } } public void mousePressed(MouseEvent e){ maapind=getHeight(); pallid.add(new Pall(ox(e.getX()), oy(e.getY()))); } 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 KukkuvPall3()); f.setSize(200, 200); f.setVisible(true); } class Pall{ long algaeg=System.currentTimeMillis(); double ax, ay; public Pall(double ux, double uy){ ax=ux; ay=uy; } double kysiX(){return ax;} double kysiY(){ double t=(System.currentTimeMillis()-algaeg)/1000.0; return ay-9.8*t*t/2; } } }