Example usage for java.awt Window getCursor

List of usage examples for java.awt Window getCursor

Introduction

In this page you can find the example usage for java.awt Window getCursor.

Prototype

public Cursor getCursor() 

Source Link

Document

Gets the cursor set in the component.

Usage

From source file:tvbrowser.ui.mainframe.MainFrame.java

/**
 * Show Settings Dialog for a specific TabId
 *
 * @param visibleTabId//from   w ww.j ava  2 s  .c  o  m
 *          Id of the specific Tab
 */
public void showSettingsDialog(final String visibleTabId) {
    if (mSettingsWillBeOpened) {
        return;
    }

    new Thread(new Runnable() {
        public void run() {
            mSettingsWillBeOpened = true;

            // show busy cursor
            Window comp = UiUtilities.getLastModalChildOf(MainFrame.getInstance());
            ProgramTable programTable = MainFrame.getInstance().getProgramTableScrollPane().getProgramTable();
            Cursor oldWindowCursor = comp.getCursor();
            Cursor oldTableCursor = programTable.getCursor();
            comp.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            programTable.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            SettingsDialog dlg = new SettingsDialog(MainFrame.this, visibleTabId);
            dlg.centerAndShow();

            // restore cursors
            programTable.setCursor(oldTableCursor);
            comp.setCursor(oldWindowCursor);

            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    Settings.handleChangedSettings();
                    if (mPluginView != null) {
                        mPluginView.refreshTree();
                    }
                }
            });
            mSettingsWillBeOpened = false;
        }
    }, "Show settings dialog").start();
}