This Java tip demostrates a method of changing the type/shape of a cursor. Java provides developer with a facility of changing the shape of the cursor in a situation such as when cursor is above a component. The cursor may be changed at any time by calling Component.setCursor(). There are predefined cursor shapes alredy defined in cursor class, the developer may look at the available cursors before setting its shape.
// Create a component Component oKButton = new Button("OK"); // By default, the component's cursor is Cursor.DEFAULT_CURSOR Cursor cursorshape = oKButton.getCursor(); // Change the component's cursor to another shape oKButton.setCursor(cursorshape.getPredefinedCursor(oKButton.HAND_CURSOR));