Here you can find the source of setCursor(JComponent comp, Cursor cur)
public static void setCursor(JComponent comp, Cursor cur)
//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 . j a va2s . c o m*/ * 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); } } }