import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.applet.Applet; public class Liikumine1 extends Applet implements ActionListener, MouseListener{ double x=100; double y=50; double korvix=250, korviy=270, korvid=40; double dx=1, dy=1; int d=5; Timer t=new Timer(100, this); double kiirus=10; TextField tf1=new TextField(String.valueOf(kiirus)); double nurk=60; TextField tf2=new TextField(String.valueOf(nurk)); Label lbTeade=new Label("Oota:"); public Liikumine1(){ add(new Label("Kiirus:")); add(tf1); add(new Label("Nurk:")); add(tf2); add(lbTeade); arvutaSammud(); t.start(); addMouseListener(this); } void arvutaSammud(){ kiirus=Double.parseDouble(tf1.getText()); nurk=Double.parseDouble(tf2.getText()); dx=kiirus*Math.cos(Math.toRadians(nurk)); dy=kiirus*Math.sin(Math.toRadians(nurk)); } public void mousePressed(MouseEvent e){ x=e.getX(); y=e.getY(); arvutaSammud(); } public void mouseReleased(MouseEvent e){} public void mouseClicked(MouseEvent e){} public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){} public void paint(Graphics g){ g.drawRect((int)x, (int)y, d, d); g.drawRect((int)korvix, (int)korviy, (int)korvid, (int)korvid); } public void liigu(){ x=x+dx; y=y-dy; dy=dy-1; if(x>korvix && xkorviy && y