Changing the Cursor : Cursor « Swing « Java Tutorial






import java.awt.Button;
import java.awt.Component;
import java.awt.Cursor;

import javax.swing.JFrame;

public class Main {
  public static void main() {
    Component comp = new Button("OK");

    Cursor cursor = comp.getCursor();

    comp.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    JFrame frame = new JFrame();
    frame.add(comp);
    frame.setSize(300, 300);
    frame.setVisible(true);
  }
}








14.115.Cursor
14.115.1.Using Cursors
14.115.2.Change the cursor shape
14.115.3.Changing the Cursor
14.115.4.Change Cursor in a thread for animation