JumpingWorld Applet
Code
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class JumpingWorld extends Applet
implements MouseListener {
private int x = 50, y = 50;
public void init() {
// Register to be notified of mouse clicks.
addMouseListener(this);
}
public void paint(Graphics g) {
g.drawString("Hello World", x, y);
}
public void mouseClicked(MouseEvent e) {
x = e.getX();
y = e.getY();
repaint();
}
public void mouseExited(MouseEvent e) { }
public void mouseEntered(MouseEvent e) { }
public void mousePressed(MouseEvent e) { }
public void mouseReleased(MouseEvent e) { }
}