Example usage for java.awt Cursor WAIT_CURSOR

List of usage examples for java.awt Cursor WAIT_CURSOR

Introduction

In this page you can find the example usage for java.awt Cursor WAIT_CURSOR.

Prototype

int WAIT_CURSOR

To view the source code for java.awt Cursor WAIT_CURSOR.

Click Source Link

Document

The wait cursor type.

Usage

From source file:org.sleuthkit.autopsy.keywordsearch.ExtractedContentViewer.java

private void previousPage() {
    if (currentSource.hasPreviousPage()) {
        currentSource.previousPage();/*from  w  w w.  j a  v  a  2 s .  co m*/

        //set new text
        panel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        panel.refreshCurrentMarkup();
        panel.setCursor(null);

        //update display
        panel.updateCurrentPageDisplay(currentSource.getCurrentPage());

        //scroll to current selection
        ExtractedContentViewer.this.scrollToCurrentHit();

        //update controls if needed
        if (!currentSource.hasPreviousPage()) {
            panel.enablePrevPageControl(false);
        }
        if (currentSource.hasNextPage()) {
            panel.enableNextPageControl(true);
        }

        updateSearchControls();

    }
}

From source file:com.vgi.mafscaling.OpenLoop.java

public void saveData() {
    if (JFileChooser.APPROVE_OPTION != fileChooser.showSaveDialog(this))
        return;/*from   w ww.j  av  a2  s  .  co m*/
    File file = fileChooser.getSelectedFile();
    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    int i, j;
    FileWriter out = null;
    try {
        out = new FileWriter(file);
        // write string identifier
        out.write(SaveDataFileHeader + "\n");
        // write maf data
        for (i = 0; i < mafTable.getRowCount(); ++i) {
            for (j = 0; j < mafTable.getColumnCount(); ++j)
                out.write(mafTable.getValueAt(i, j).toString() + ",");
            out.write("\n");
        }
        // write run data
        for (int t = 0; t < runTables.length; ++t) {
            for (i = 0; i < runTables[t].getColumnCount(); ++i) {
                for (j = 0; j < runTables[t].getRowCount(); ++j)
                    out.write(runTables[t].getValueAt(j, i).toString() + ",");
                out.write("\n");
            }
        }
    } catch (Exception e) {
        logger.error(e);
    } finally {
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        if (out != null) {
            try {
                out.close();
            } catch (IOException e) {
                logger.error(e);
            }
        }
    }
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.EditorUI.java

/**
 * Removes the links, tags attachments./*from w ww.java  2  s . c  om*/
 * 
 * @param level One of the constants defined by this class.
 */
private void removeLinks(int level, Collection l) {
    saved = true;
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    toolBar.setDataToSave(false);
    Iterator<AnnotationData> i = l.iterator();
    AnnotationData o;
    List<Object> toRemove = new ArrayList<Object>();
    List<Object> links;
    while (i.hasNext()) {
        o = i.next();
        links = model.getLinks(level, o);
        if (links != null) {
            toRemove.addAll(links);
        }
    }
    DataToSave object = new DataToSave(new ArrayList<AnnotationData>(), toRemove);
    model.fireAnnotationSaving(object, null, true);
}

From source file:com.vgi.mafscaling.ClosedLoop.java

private void clearLogDataTables() {
    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    try {//from www .  j  a  v a2  s  .  c om
        while (LogDataRowCount < logDataTable.getRowCount())
            Utils.removeRow(LogDataRowCount, logDataTable);
        Utils.clearTable(logDataTable);
    } finally {
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
}

From source file:com.vgi.mafscaling.ClosedLoop.java

private void clearAfrDataTables() {
    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    try {/*from   w w  w.ja v  a 2 s  . c om*/
        clearAfrDataTable(afr1Table);
        clearAfrDataTable(afr2Table);
    } finally {
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
}

From source file:AltiConsole.AltiConsoleMainScreen.java

public boolean ErasingFlight() {
    this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    if (Serial.getConnected() == false) {
        boolean ret = false;
        ret = ConnectToAlti();//from   ww  w.  j a va  2 s. co  m
        if (!ret) {
            System.out.println("Data retrieval timed out\n");
            this.setCursor(Cursor.getDefaultCursor());
            return false;
        }
    }
    Serial.writeData("e;\n");
    this.setCursor(Cursor.getDefaultCursor());
    return true;
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java

public void setWaitCursor(boolean isWaiting) {
    if (isWaiting) {
        Cursor hourglass = new Cursor(Cursor.WAIT_CURSOR);
        setCursor(hourglass);/*from  ww  w .j a  v  a2 s  . c o  m*/
    } else {
        Cursor normal = new Cursor(Cursor.DEFAULT_CURSOR);
        setCursor(normal);
    }
}

From source file:org.omegat.gui.main.ProjectUICommands.java

public static void projectReload() {
    UIThreadsUtil.mustBeSwingThread();/* ww w.j  a  v  a 2  s .c om*/

    if (!Core.getProject().isProjectLoaded()) {
        return;
    }

    // commit the current entry first
    Core.getEditor().commitAndLeave();

    final ProjectProperties props = Core.getProject().getProjectProperties();

    new SwingWorker<Object, Void>() {
        int previousCurEntryNum = Core.getEditor().getCurrentEntryNumber();

        protected Object doInBackground() throws Exception {
            IMainWindow mainWindow = Core.getMainWindow();
            Cursor hourglassCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
            Cursor oldCursor = mainWindow.getCursor();
            mainWindow.setCursor(hourglassCursor);

            Core.executeExclusively(true, () -> {
                Core.getProject().saveProject(true);
                ProjectFactory.closeProject();

                ProjectFactory.loadProject(props, true);
            });
            mainWindow.setCursor(oldCursor);
            return null;
        }

        protected void done() {
            try {
                get();
                SwingUtilities.invokeLater(() -> {
                    // activate entry later - after project will be loaded
                    Core.getEditor().gotoEntry(previousCurEntryNum);
                    Core.getEditor().requestFocus();
                });
            } catch (Exception ex) {
                processSwingWorkerException(ex, "PP_ERROR_UNABLE_TO_READ_PROJECT_FILE");
            }
        }
    }.execute();
}

From source file:com.vgi.mafscaling.OpenLoop.java

public void loadData() {
    fileChooser.setMultiSelectionEnabled(false);
    if (JFileChooser.APPROVE_OPTION != fileChooser.showOpenDialog(this))
        return;/*from  w w  w .  j a  va  2 s  . c o  m*/
    File file = fileChooser.getSelectedFile();
    int i, j, k, l;
    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    BufferedReader br = null;
    try {
        br = new BufferedReader(new FileReader(file.getAbsoluteFile()));
        String line = br.readLine();
        if (line == null || !line.equals(SaveDataFileHeader)) {
            JOptionPane.showMessageDialog(null, "Invalid saved data file!", "Error", JOptionPane.ERROR_MESSAGE);
            return;
        }
        line = br.readLine();
        String[] elements;
        JTable table = null;
        i = k = l = 0;
        while (line != null) {
            elements = line.split(",", -1);
            switch (i) {
            case 0:
                Utils.ensureColumnCount(elements.length - 1, mafTable);
                for (j = 0; j < elements.length - 1; ++j)
                    mafTable.setValueAt(elements[j], i, j);
                break;
            case 1:
                Utils.ensureColumnCount(elements.length - 1, mafTable);
                for (j = 0; j < elements.length - 1; ++j)
                    mafTable.setValueAt(elements[j], i, j);
                break;
            default:
                int offset = runTables.length * 3 + mafTable.getRowCount();
                if (i > 1 && i < offset) {
                    if (l == 0)
                        table = runTables[k++];
                    Utils.ensureRowCount(elements.length - 1, table);
                    for (j = 0; j < elements.length - 1; ++j)
                        table.setValueAt(elements[j], j, l);
                    l += 1;
                    if (l == 3)
                        l = 0;
                }
            }
            i += 1;
            line = br.readLine();
        }
    } catch (Exception e) {
        e.printStackTrace();
        logger.error(e);
    } finally {
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        if (br != null) {
            try {
                br.close();
            } catch (IOException e) {
                logger.error(e);
            }
        }
    }
}

From source file:biz.wolschon.finance.jgnucash.JGnucash.java

/**
 * Show the file->save as... -dialog.
 *///w  ww .  jav a 2  s . co  m
private void saveFileAs() {
    int state = getJFileChooser().showSaveDialog(this);
    if (state == JFileChooser.APPROVE_OPTION) {
        File f = getJFileChooser().getSelectedFile();
        try {
            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            getWritableModel().writeFile(f);
            saveFile();
            setTitle(f.getName());
        } catch (FileNotFoundException e) {
            LOGGER.error("cannot save file '" + f.getAbsolutePath() + "' (file not found)", e);
            JOptionPane.showMessageDialog(this, "Error",
                    "cannot save file '" + f.getAbsolutePath() + "' (file not found)",
                    JOptionPane.ERROR_MESSAGE);
        } catch (IOException e) {
            LOGGER.error("cannot save file '" + f.getAbsolutePath() + "' (io-problem)", e);
            JOptionPane.showMessageDialog(this, "Error",
                    "cannot save file '" + f.getAbsolutePath() + "' (io-problem)", JOptionPane.ERROR_MESSAGE);
        } catch (JAXBException e) {
            LOGGER.error("cannot save file '" + f.getAbsolutePath() + "' (gnucash-format-problem)", e);
            JOptionPane.showMessageDialog(this, "Error",
                    "cannot save file '" + f.getAbsolutePath() + "' (gnucash-format-problem)",
                    JOptionPane.ERROR_MESSAGE);
        } finally {
            setCursor(Cursor.getDefaultCursor());
        }
    }
}