Components and Cursors

The AWT supports the ability to set a component's cursor; to set the cursor for a component, you pass the component's setCursor method an instance of a Cursor. The Cursor class comes with a set of predefined cursors, which can be accessed by invoking Cursor.getPredefinedCursor(), which expects to be passed one of the integer constants listed in Table 11-6.

Table 11-6. Cursor Constants for Predefined Cursors
Cursor
DEFAULT_CURSOR
CROSSHAIR_CURSOR
TEXT_CURSOR
WAIT_CURSOR
SW_RESIZE_CURSOR
SE_RESIZE_CURSOR
NW_RESIZE_CURSOR
NE_RESIZE_CURSOR
N_RESIZE_CURSOR
S_RESIZE_CURSOR
W_RESIZE_CURSOR
E_RESIZE_CURSOR
HAND_CURSOR
MOVE_CURSOR

Figure 11-2 shows an applet equipped with a choice whose items represent predefined cursors. When a ...

Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.