Java Swing Tutorial - Java Cursor HAND_CURSOR








Syntax

Cursor.HAND_CURSOR has the following syntax.

public static final int HAND_CURSOR

Example

In the following code shows how to use Cursor.HAND_CURSOR field.

/*from  w  w  w . java2s  .  c  o m*/
import java.awt.Cursor;

import javax.swing.JFrame;

public class Main {
  public static void main(String[] args) {
    JFrame aWindow = new JFrame();
    aWindow.setBounds(200, 200, 200, 200);
    aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    aWindow.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    aWindow.setVisible(true);
  }
}