Here you can find the source of startWaitCursor(JComponent component)
component
.
Parameter | Description |
---|---|
component | The component to block. |
public static void startWaitCursor(JComponent component)
//package com.java2s; //License from project: LGPL import java.awt.Cursor; import java.awt.event.MouseAdapter; import javax.swing.JComponent; import javax.swing.RootPaneContainer; public class Main { /**/*from w w w. ja v a 2 s .c om*/ * A no-op MouseAdapter used to stop mouse input. */ private static final MouseAdapter noopMouseAdapter = new MouseAdapter() { // nothing to see here }; /** * Sets the wait (hourglass) mouse cursor for an application containing <code>component</code>. * @param component The component to block. */ public static void startWaitCursor(JComponent component) { RootPaneContainer root = (RootPaneContainer) component.getTopLevelAncestor(); root.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); root.getGlassPane().addMouseListener(noopMouseAdapter); root.getGlassPane().setVisible(true); } }