Java Swing Cursor setWaitCursor(JComponent comp)

Here you can find the source of setWaitCursor(JComponent comp)

Description

Sets the wait mouse cursor for this component

License

Open Source License

Declaration

public static void setWaitCursor(JComponent comp) 

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

Related

  1. createCursor(URL url, Point hotSpot, String name)
  2. setCursor(JComponent comp, Cursor cur)
  3. setCursorBusy(JComponent component)
  4. setCursorDefault(Container cont)
  5. setWaitCursor(final Component c, final boolean wait)
  6. showCursor(final Cursor cursor, final Component caller, final boolean includeParent, boolean immediate)
  7. showCursor(final Cursor cursor, final Component caller, final boolean includeParent, boolean immediate)
  8. showDefaultCursor()
  9. showDefaultCursorOnWindow(Component caller)