Change the cursor shape : Cursor « Swing « Java Tutorial






import java.awt.Cursor;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class Main extends JFrame {
  public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        Main mainForm = new Main();
        mainForm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        mainForm.setSize(250, 250);

        Cursor cursor = new Cursor(Cursor.HAND_CURSOR);
        mainForm.setCursor(cursor);

        mainForm.pack();
        mainForm.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