How do I change the cursor over an Applet?

Jorge Jordão

You can use java.awt.Component's setCursor(java.awt.Cursor) method.

Create a (system-looking) cursor with the java.awt.Cursor constructor and class constants (DEFAULT_CURSOR, HAND_CURSOR, WAIT_CURSOR, etc).

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

public class CursorApplet extends Applet {

    public void init() {
        setCursor(new Cursor(Cursor.HAND_CURSOR));


Since JDK 1.2 you can also use java.awt.Toolkit's createCustomCursor(java.awt.Image, java.awt.Point, java.lang.String) method to create a custom cursor, but keep in mind that current popular browsers only support JDK 1.1 (unless you use the Java Plug-in).