Share this page 

Change the mouse cursor in Applet (this howto is deprecated)Tag(s): DEPRECATED


[JDK1.0.2]
// loop until the browser frame
Frame browserFrame;
Component parentComponent;
parentComponent = getParent();
while ( parentComponent != null &&
         !(parentComponent instanceof Frame)) {
  parentComponent = parentComponent.getParent();
}

browserFrame = (Frame) parentComponent;
browserFrame.setCursor(Frame.WAIT_CURSOR);

// CROSSHAIR_CURSOR, DEFAULT_CURSOR,
// E_RESIZE_CURSOR, HAND_CURSOR
// MOVE_CURSOR, N_RESIZE_CURSOR,
// NE_RESIZE_CURSOR, NW_RESIZE_CURSOR;
// S_RESIZE_CURSOR,SE_RESIZE_CURSOR,
// SW_RESIZE_CURSOR, TEXT_CURSOR,
// W_RESIZE_CURSOR, WAIT_CURSOR

[JDK1.1]

// setCursor is supported at the component level
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));