| |
e574. Changing the Cursor
A component has a cursor property which controls the shape of the
cursor when the cursor is above the component. The component's
cursor property can be changed at any time by calling
Component.setCursor(). See the Cursor class for available
predefined cursor shapes.
// Create a component
Component comp = new Button("OK");
// By default, the component's cursor is Cursor.DEFAULT_CURSOR
Cursor cursor = comp.getCursor();
// Change the component's cursor to another shape
comp.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
© 2002 Addison-Wesley.
| | |