import java.awt.*; import java.awt.event.*; import java.applet.Applet; public class viies2 extends Applet implements MouseMotionListener{ int vasak; TextField tekstivali=new TextField(30); public void init(){ addMouseMotionListener(this); Panel paneel= new Panel(); paneel.add(tekstivali); add(paneel); } public void mouseDragged(MouseEvent e){ Graphics g=this.getGraphics(); g.setColor(Color.white); g.fillRect(0, 0, getSize().width, getSize().height); g.setColor(Color.blue); g.fillOval(vasak-5, e.getY()-5, 400-e.getY(),400-e.getY()-10); TextField koordin = new TextField(); add(koordin); vasak=e.getX(); System.out.println(e.getX()+", "+e.getY()); tekstivali.setText(e.getX()+", "+e.getY()); } public void mouseMoved(MouseEvent e){ tekstivali.setText(e.getX()+", "+e.getY()); } }