Here you can find the source of setWaitCursor(JComponent comp)
public static void setWaitCursor(JComponent comp)
//package com.java2s; // modify it under the terms of the GNU General Public License version 2 import javax.swing.*; import java.awt.*; public class Main { /**//w w w. ja v a 2 s . c om * Sets the wait mouse cursor for this component */ public static void setWaitCursor(JComponent comp) { setCursor(comp, new Cursor(Cursor.WAIT_CURSOR)); } /** * Sets the mouse cursor for a component */ public static void setCursor(JComponent comp, Cursor cur) { comp.setCursor(cur); Component parent = comp.getParent(); while (parent != null) { parent = parent.getParent(); if (parent != null) parent.setCursor(cur); } } }