The source code looks like:

import java.applet.*;
import java.awt.*;
import java.awt.Graphics;

public class DragText extends Applet {

	int xpos;
	int ypos;

	public void init() {
		resize(300, 100);
	}

	public void paint(Graphics g) {

		g.drawString("Drag me...", xpos, ypos);

	}

	public boolean mouseDown(Event e, int x, int y) {

		xpos=x;
		ypos=y;
		repaint();
		return true;
	}

	public boolean mouseDrag(Event e, int x, int y) {

		xpos = x;
		ypos = y;
		repaint();
		return true;

	}
}