These predefined constants in the Cursor class are not
cursors, they are int codes that are used as a parameter in the
Cursor.getPredefinedCursor(int) method.
| int type | description |
| Cursor.DEFAULT_CURSOR | default cursor |
| Cursor.CROSSHAIR_CURSOR | crosshair cursor |
| Cursor.HAND_CURSOR | hand cursor |
| Cursor.MOVE_CURSOR | move cursor |
| Cursor.WAIT_CURSOR | wait cursor |
| Cursor.TEXT_CURSOR | text cursor |
| Cursor.E_RESIZE_CURSOR | east-resize cursor |
| Cursor.N_RESIZE_CURSOR | north-resize cursor |
| Cursor.NE_RESIZE_CURSOR | north-east-resize cursor |
| Cursor.NW_RESIZE_CURSOR | north-west-resize cursor |
| Cursor.S_RESIZE_CURSOR | south-resize cursor |
| Cursor.SE_RESIZE_CURSOR | south-east-resize cursor |
| Cursor.SW_RESIZE_CURSOR | south-west-resize cursor |
| Cursor.W_RESIZE_CURSOR | west-resize cursor |
setCursor(...) method, the
cursor will be changed. The parameter to setCursor(. . .)
is a Cursor object. You can create your own cursors, but you will
probably be satisfied using the predefined cursors.
Container c = frame.getContentPane(); // get the window's content pane
c.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
. . . // do something that takes a long time
c.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
or
c.setCursor(Cursor.getDefaultCursor());
Toolkit.createCustomCursor()) or
use cursors from the local system (see Cursor.getSystemCustomCursor(String)).