Example usage for javax.swing JRootPane getGlassPane

List of usage examples for javax.swing JRootPane getGlassPane

Introduction

In this page you can find the example usage for javax.swing JRootPane getGlassPane.

Prototype

public Component getGlassPane() 

Source Link

Document

Returns the current glass pane for this JRootPane.

Usage

From source file:Main.java

/**
 * Returns glass pane for the specified component or null if it doesn't exist.
 *
 * @param component component to look under
 * @return glass pane for the specified component or null if it doesn't exist
 *//*from w  ww .j a v  a2  s  . co  m*/
public static Component getGlassPane(final Component component) {
    final JRootPane rootPane = getRootPane(component);
    return rootPane != null ? rootPane.getGlassPane() : null;
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Sets the mouse pointer. If the supplied parameter is true then the wait
 * cursor (usually an hourglass) is displayed. otherwise the system default
 * cursor is displayed.//from w w w  . ja  v a 2  s . c  o m
 * 
 * @param wait
 *          Whether to display the system default wait cursor
 */
private void setWaitCursor(boolean wait) {
    final JRootPane rootPane = getRootPane();
    final Component glassPane = rootPane.getGlassPane();

    if (wait) {
        final Cursor cursorWait = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
        rootPane.setCursor(cursorWait);
        glassPane.setCursor(cursorWait);
        glassPane.setVisible(true);
    } else {
        final Cursor cursorDefault = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
        glassPane.setVisible(false);
        glassPane.setCursor(cursorDefault);
        rootPane.setCursor(cursorDefault);
    }

    glassPane.invalidate();
    rootPane.validate();
}