Java Swing Cursor setCursor(JComponent comp, Cursor cur)

Here you can find the source of setCursor(JComponent comp, Cursor cur)

Description

Sets the mouse cursor for a component

License

Open Source License

Declaration

public static void setCursor(JComponent comp, Cursor cur) 

Method Source Code

//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);
        }
    }
}

Related

  1. createCursor(URL url, Point hotSpot, String name)
  2. setCursorBusy(JComponent component)
  3. setCursorDefault(Container cont)
  4. setWaitCursor(final Component c, final boolean wait)
  5. setWaitCursor(JComponent comp)