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.docx4all.ui.main.WordMLEditor.java

public void showViewInTab(final String tabTitle) {
    if (getCurrentInternalFrame() != null) {
        Cursor origCursor = getMainFrame().getCursor();
        getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

        getCurrentViewManager().showViewTab(tabTitle);

        getMainFrame().setCursor(origCursor);
    }//from  www .jav  a2 s. co  m
}

From source file:org.openmicroscopy.shoola.agents.dataBrowser.browser.BrowserModel.java

/**
 * Implemented as specified by the {@link Browser} interface.
 * @see Browser#resetChildDisplay()//from  w ww .  j  a v a 2 s.co  m
 */
public void resetChildDisplay() {
    rootDisplay.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    Collection<ImageDisplay> rootChildren = rootDisplay.getChildrenDisplay();
    JComponent desktop = rootDisplay.getInternalDesktop();
    desktop.removeAll();
    Iterator<ImageDisplay> i;
    switch (selectedLayout.getIndex()) {
    case LayoutFactory.SQUARY_LAYOUT:
        i = rootChildren.iterator();
        ImageDisplay child;
        while (i.hasNext()) {
            child = i.next();
            desktop.add(child);
            addToDesktop(child);
        }
        break;

    case LayoutFactory.FLAT_LAYOUT:
        i = getImageNodes().iterator();
        while (i.hasNext())
            desktop.add(i.next());
    }
    rootDisplay.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:br.ufrgs.enq.jcosmo.ui.COSMOSACDialog.java

private void rebuildSigmaProfiles() {
    if (listModel.getSize() == 0) {
        if (err == true) {
            err = false;/*from   w w w  .  j  av a 2  s. c  o  m*/
            return;
        }
        JOptionPane.showMessageDialog(this, "Select compounds.", "Error", JOptionPane.OK_OPTION);
        return;
    }

    int num = listModel.getSize();
    COSMOSACCompound[] c = new COSMOSACCompound[num];
    double[][] area = new double[num][];
    double[][] charge = new double[num][];
    XYSeriesCollection dataset = new XYSeriesCollection();

    for (int i = 0; i < num; i++) {
        try {
            c[i] = db.getComp((String) listModel.getElementAt(i));
        } catch (SQLException e1) {
            e1.printStackTrace();
            return;
        }
    }

    COSMOSAC cosmosac = (COSMOSAC) modelBox.getSelectedItem();
    try {
        cosmosac.setComponents(c);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    NumberFormat nf = NumberFormat.getInstance();
    nf.setMaximumFractionDigits(2);

    for (int i = 0; i < num; i++) {

        if (c[i] == null)
            return;

        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

        area[i] = c[i].area;
        charge[i] = c[i].charge;

        int n = charge[0].length;
        XYSeries comp = new XYSeries(c[i].name);

        // charges represent the center of the segments
        comp.add(charge[i][0], area[i][0]);
        for (int j = 1; j < n; ++j) {
            comp.add(charge[i][j] - (charge[i][j] - charge[i][j - 1]) / 2, area[i][j]);
        }

        double areaT = 0;
        double absSigmaAvg = 0;
        double sigmaAvg2 = 0;
        for (int j = 1; j < n; ++j) {
            areaT += area[i][j];
            absSigmaAvg += area[i][j] * Math.abs(charge[i][j]);
            sigmaAvg2 += area[i][j] * charge[i][j] * charge[i][j];
        }
        absSigmaAvg /= areaT;
        sigmaAvg2 /= areaT;
        comp.setKey(c[i].name + " (A=" + nf.format(areaT) + ", |sigma|=" + nf.format(absSigmaAvg * 1000)
                + ", |sigma|2=" + nf.format(sigmaAvg2 * 10000) + ")");

        dataset.addSeries(comp);
        sigmaProfilePlot.setRenderer(i, stepRenderer);
        sigmaProfilePlot.getRenderer().setSeriesStroke(i, new BasicStroke(2.5f));
    }
    sigmaProfilePlot.setDataset(dataset);

    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

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

private void nextPage() {
    if (currentSource.hasNextPage()) {
        currentSource.nextPage();/*from  w w w  . ja  v a  2  s .c  o  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.hasNextPage()) {
            panel.enableNextPageControl(false);
        }
        if (currentSource.hasPreviousPage()) {
            panel.enablePrevPageControl(true);
        }

        updateSearchControls();
    }
}

From source file:de.juwimm.cms.Main.java

public void actionPerformed(ActionEvent e) {
    String action = e.getActionCommand();
    this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    try {//from   ww w. j a  va  2s  .  com
        if (action.equals(Constants.ACTION_EXIT)) {
            if (ActionHub.fireExitPerformed(new ExitEvent())) {
                comm.getDbHelper().shutdown();
                System.exit(0);
            }
        } else if (action.equals(Constants.ACTION_LOGIN)) {
            this.setLayout(new BorderLayout());
            Constants.CMS_CLIENT_VIEW = -1;
            setCenterPanel(PanInitView.getInstance());

            if (panStatusbar == null) {
                panStatusbar = new PanStatusbar();
                UIConstants.setStatusLine(panStatusbar);
                ActionHub.addActionListener(panStatusbar);
            }

            if (panRibbon == null) {
                panRibbon = new PanRibbon(comm);
                ActionHub.addActionListener(panRibbon);
            }
            this.getContentPane().add(panRibbon, BorderLayout.NORTH);
            ActionHub.fireActionPerformed(
                    new ActionEvent(this, ActionEvent.ACTION_PERFORMED, Constants.ACTION_VIEW_EDITOR));

            //      this.getJMenuBar().setVisible(true);
            //      this.getContentPane().add(panToolbar, BorderLayout.NORTH);
            this.getContentPane().add(panStatusbar, BorderLayout.SOUTH);

            this.getRootPane().setDoubleBuffered(true);
            this.getRootPane().validate();
            this.getRootPane().repaint();
        } else if (action.equals(Constants.ACTION_LOGOFF)) {
            if (ActionHub.fireExitPerformed(new ExitEvent())) {
                comm.setLoggedIn(false);
                Application.initializeContext();
                panLogin = new PanLogin();
                panRoot = null;
                panAdmin = null;
                panRibbon = null;
                this.getContentPane().removeAll();
                //this.getJMenuBar().setVisible(false);
                comm.getDbHelper().autoEmptyCache();
                PanContentView.getInstance().unloadAll();
                setCenterPanel(panLogin);
                Constants.CMS_CLIENT_VIEW = Constants.CLIENT_VIEW_LOGIN;
                this.validate();
                this.getContentPane().validate();
                this.getContentPane().repaint();
                this.repaint();
                panLogin.init();
            }
        } else if (action.equals(Constants.ACTION_VIEW_EDITOR)) {
            showToolPanel(false, e);
            panTool = PanTool.getInstance();
            Constants.CMS_CLIENT_VIEW = Constants.CLIENT_VIEW_CONTENT;
        } else if (action.equals(Constants.ACTION_VIEW_EDITOR_WITH_SELECTION)) {
            showToolPanel(true, e);
            panTool = PanTool.getInstance();
            Constants.CMS_CLIENT_VIEW = Constants.CLIENT_VIEW_CONTENT;
        } else if (action.equals(Constants.ACTION_VIEW_ADMIN) || action.equals(Constants.ACTION_VIEW_ROOT)) {
            Constants.CMS_CLIENT_VIEW = Constants.CLIENT_VIEW_ADMIN;
            showAdminPanel();
            panStatusbar.setCountVisible(false);
        } else if (action.equals(Constants.ACTION_CHANGE_PASSWORD)) {
            showChangePasswordDialog();
        } else if (action.equals(Constants.ACTION_SHOW_TASK)) {
            showTaskPanel();
            panStatusbar.setCountVisible(false);
            Constants.CMS_CLIENT_VIEW = Constants.CLIENT_VIEW_TASK;
        } else if (action.equals(Constants.ACTION_SHOW_CONTENT)) {
            Constants.CMS_CLIENT_VIEW = Constants.CLIENT_VIEW_CONTENT;
        }
    } catch (Exception exe) {
        log.error("Error in actionPerformed", exe);
    } finally {
        this.setCursor(Cursor.getDefaultCursor());
    }
}

From source file:es.mityc.firmaJava.libreria.pkcs7.ValidaTarjeta.java

private void validarTarjeta() {
    Runnable doWorkRunnable = new Runnable() {
        public void run() {
            ConexionTarjeta c = ConexionTarjeta.getInstance();
            try {
                ks = c.conectar(jPinPasswordField.getPassword(), jLibreriaTextField.getText());
                ValidaTarjeta.this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                dispose();//from w  w  w  .  j  a v a2  s  .  c om
            } catch (ProviderException e1) {
                JOptionPane.showMessageDialog(jPanel, e1.getMessage(),
                        I18n.getResource(LIBRERIAXADES_VALIDARTARJETA_TEXTO_23), JOptionPane.ERROR_MESSAGE);
            } catch (PKCS11Exception e1) {
                String mensajeError = mensajeErrorConexion(String.valueOf(e1.getErrorCode()));
                JOptionPane.showMessageDialog(jPanel, mensajeError,
                        I18n.getResource(LIBRERIAXADES_VALIDARTARJETA_TEXTO_23), JOptionPane.ERROR_MESSAGE);
            }
            ValidaTarjeta.this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        }
    };

    ValidaTarjeta.this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
    SwingUtilities.invokeLater(doWorkRunnable);
}

From source file:org.executequery.gui.editor.QueryEditorTextPane.java

private void fireTextUpdateStarting() {
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    uninstallListeners();
}

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

protected void loadLogFile() {
    fileChooser.setMultiSelectionEnabled(true);
    if (JFileChooser.APPROVE_OPTION != fileChooser.showOpenDialog(this))
        return;/* w  ww.j ava 2  s .  co  m*/
    File[] files = fileChooser.getSelectedFiles();
    for (File file : files) {
        BufferedReader br = null;
        ArrayDeque<String[]> buffer = new ArrayDeque<String[]>();
        try {
            br = new BufferedReader(new FileReader(file.getAbsoluteFile()));
            String line = br.readLine();
            if (line != null) {
                String[] elements = line.split("(\\s*)?,(\\s*)?", -1);
                getColumnsFilters(elements);

                boolean resetColumns = false;
                if (logThrottleAngleColIdx >= 0 || logFfbColIdx >= 0 || logSdColIdx >= 0
                        || (logWbAfrColIdx >= 0 && isOl) || (logStockAfrColIdx >= 0 && !isOl)
                        || (logAfLearningColIdx >= 0 && !isOl) || (logAfCorrectionColIdx >= 0 && !isOl)
                        || logRpmColIdx >= 0 || logMafColIdx >= 0 || logIatColIdx >= 0 || logMpColIdx >= 0) {
                    if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(null,
                            "Would you like to reset column names or filter values?", "Columns/Filters Reset",
                            JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE))
                        resetColumns = true;
                }

                if (resetColumns || logThrottleAngleColIdx < 0 || logFfbColIdx < 0 || logSdColIdx < 0
                        || (logWbAfrColIdx < 0 && isOl) || (logStockAfrColIdx < 0 && !isOl)
                        || (logAfLearningColIdx < 0 && !isOl) || (logAfCorrectionColIdx < 0 && !isOl)
                        || logRpmColIdx < 0 || logMafColIdx < 0 || logIatColIdx < 0 || logMpColIdx < 0) {
                    ColumnsFiltersSelection selectionWindow = new VEColumnsFiltersSelection(false);
                    if (!selectionWindow.getUserSettings(elements) || !getColumnsFilters(elements))
                        return;
                }

                if (logClOlStatusColIdx == -1)
                    clValue = -1;

                String[] flds;
                String[] afrflds;
                boolean removed = false;
                int i = 2;
                int clol = -1;
                int row = getLogTableEmptyRow();
                double thrtlMaxChange2 = thrtlMaxChange + thrtlMaxChange / 2.0;
                double throttle = 0;
                double pThrottle = 0;
                double ppThrottle = 0;
                double afr = 0;
                double rpm;
                double ffb;
                double iat;
                clearRunTables();
                setCursor(new Cursor(Cursor.WAIT_CURSOR));
                for (int k = 0; k <= afrRowOffset && line != null; ++k) {
                    line = br.readLine();
                    if (line != null)
                        buffer.addFirst(line.split(",", -1));
                }
                try {
                    while (line != null && buffer.size() > afrRowOffset) {
                        afrflds = buffer.getFirst();
                        flds = buffer.removeLast();
                        line = br.readLine();
                        if (line != null)
                            buffer.addFirst(line.split(",", -1));
                        ppThrottle = pThrottle;
                        pThrottle = throttle;
                        throttle = Double.valueOf(flds[logThrottleAngleColIdx]);
                        try {
                            if (row > 0 && Math.abs(pThrottle - throttle) > thrtlMaxChange) {
                                if (!removed)
                                    Utils.removeRow(row--, logDataTable);
                                removed = true;
                            } else if (row <= 0 || Math.abs(ppThrottle - throttle) <= thrtlMaxChange2) {
                                // Filters
                                afr = (isOl ? Double.valueOf(afrflds[logWbAfrColIdx])
                                        : Double.valueOf(afrflds[logStockAfrColIdx]));
                                rpm = Double.valueOf(flds[logRpmColIdx]);
                                ffb = Double.valueOf(flds[logFfbColIdx]);
                                iat = Double.valueOf(flds[logIatColIdx]);
                                if (clValue != -1)
                                    clol = Integer.valueOf(flds[logClOlStatusColIdx]);
                                boolean flag = isOl ? ((afr <= afrMax || throttle >= thrtlMin) && afr <= afrMax)
                                        : (afrMin <= afr);
                                if (flag && clol == clValue && rpmMin <= rpm && ffbMin <= ffb && ffb <= ffbMax
                                        && iat <= iatMax) {
                                    removed = false;
                                    if (!isOl)
                                        trims.add(Double.valueOf(flds[logAfLearningColIdx])
                                                + Double.valueOf(flds[logAfCorrectionColIdx]));
                                    Utils.ensureRowCount(row + 1, logDataTable);
                                    logDataTable.setValueAt(rpm, row, 0);
                                    logDataTable.setValueAt(iat, row, 1);
                                    logDataTable.setValueAt(Double.valueOf(flds[logMpColIdx]), row, 2);
                                    logDataTable.setValueAt(ffb, row, 3);
                                    logDataTable.setValueAt(afr, row, 4);
                                    logDataTable.setValueAt(Double.valueOf(flds[logMafColIdx]), row, 5);
                                    logDataTable.setValueAt(Double.valueOf(flds[logSdColIdx]), row, 6);
                                    row += 1;
                                } else
                                    removed = true;
                            } else
                                removed = true;
                        } catch (NumberFormatException e) {
                            logger.error(e);
                            JOptionPane.showMessageDialog(null,
                                    "Error parsing number at " + file.getName() + " line " + i + ": " + e,
                                    "Error processing file", JOptionPane.ERROR_MESSAGE);
                            return;
                        }
                        i += 1;
                    }
                } finally {
                    setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                }
            }
        } catch (Exception e) {
            logger.error(e);
            JOptionPane.showMessageDialog(null, e, "Error opening file", JOptionPane.ERROR_MESSAGE);
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                    logger.error(e);
                }
            }
        }
    }
}

From source file:org.sonar.scanner.protocol.viewer.ScannerReportViewerApp.java

/**
 * Initialize the contents of the frame.
 *//*w ww. ja  v a 2 s  . c o  m*/
private void initialize() {
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception e) {
        // If Nimbus is not available, you can set the GUI to another look and feel.
    }
    frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    splitPane = new JSplitPane();
    frame.getContentPane().add(splitPane, BorderLayout.CENTER);

    tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setPreferredSize(new Dimension(500, 7));
    splitPane.setRightComponent(tabbedPane);

    componentDetailsTab = new JScrollPane();
    tabbedPane.addTab("Component details", null, componentDetailsTab, null);

    componentEditor = new JEditorPane();
    componentDetailsTab.setViewportView(componentEditor);

    sourceTab = new JScrollPane();
    tabbedPane.addTab("Source", null, sourceTab, null);

    sourceEditor = createSourceEditor();
    sourceEditor.setEditable(false);
    sourceTab.setViewportView(sourceEditor);

    textLineNumber = createTextLineNumber();
    sourceTab.setRowHeaderView(textLineNumber);

    highlightingTab = new JScrollPane();
    tabbedPane.addTab("Highlighting", null, highlightingTab, null);

    highlightingEditor = new JEditorPane();
    highlightingTab.setViewportView(highlightingEditor);

    symbolTab = new JScrollPane();
    tabbedPane.addTab("Symbol references", null, symbolTab, null);

    symbolEditor = new JEditorPane();
    symbolTab.setViewportView(symbolEditor);

    coverageTab = new JScrollPane();
    tabbedPane.addTab("Coverage", null, coverageTab, null);

    coverageEditor = new JEditorPane();
    coverageTab.setViewportView(coverageEditor);

    duplicationTab = new JScrollPane();
    tabbedPane.addTab("Duplications", null, duplicationTab, null);

    duplicationEditor = new JEditorPane();
    duplicationTab.setViewportView(duplicationEditor);

    testsTab = new JScrollPane();
    tabbedPane.addTab("Tests", null, testsTab, null);

    testsEditor = new JEditorPane();
    testsTab.setViewportView(testsEditor);

    issuesTab = new JScrollPane();
    tabbedPane.addTab("Issues", null, issuesTab, null);

    issuesEditor = new JEditorPane();
    issuesTab.setViewportView(issuesEditor);

    measuresTab = new JScrollPane();
    tabbedPane.addTab("Measures", null, measuresTab, null);

    measuresEditor = new JEditorPane();
    measuresTab.setViewportView(measuresEditor);

    scmTab = new JScrollPane();
    tabbedPane.addTab("SCM", null, scmTab, null);

    scmEditor = new JEditorPane();
    scmTab.setViewportView(scmEditor);

    activeRuleTab = new JScrollPane();
    tabbedPane.addTab("ActiveRules", null, activeRuleTab, null);

    activeRuleEditor = new JEditorPane();
    activeRuleTab.setViewportView(activeRuleEditor);

    treeScrollPane = new JScrollPane();
    treeScrollPane.setPreferredSize(new Dimension(200, 400));
    splitPane.setLeftComponent(treeScrollPane);

    componentTree = new JTree();
    componentTree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("empty") {
        {
        }
    }));
    treeScrollPane.setViewportView(componentTree);
    componentTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    componentTree.addTreeSelectionListener(new TreeSelectionListener() {
        @Override
        public void valueChanged(TreeSelectionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) componentTree.getLastSelectedPathComponent();

            if (node == null) {
                // Nothing is selected.
                return;
            }

            frame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
            updateDetails((Component) node.getUserObject());
            frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

        }

    });
    frame.pack();
}

From source file:com.qspin.qtaste.ui.TestCaseTree.java

public void drop(DropTargetDropEvent dtde) {
    //try//from w  w w  .j a  v  a 2 s  .c o m
    {
        try {
            TCTreeNode tcTreeNode = (TCTreeNode) dtde.getTransferable().getTransferData(localObjectFlavor);
            Point dropPoint = dtde.getLocation();
            // int index = locationToIndex (dropPoint);
            TreePath path = getPathForLocation(dropPoint.x, dropPoint.y);
            Object targetNode = path.getLastPathComponent();
            if (targetNode instanceof TCTreeNode) {
                // rename the dragged dir into the new target one
                TCTreeNode tcTargetNode = (TCTreeNode) targetNode;
                FileNode fn = (FileNode) tcTargetNode.getUserObject();
                if (fn.isTestcaseDir()) {
                    dtde.rejectDrop();
                    return;
                }

                FileNode draggedFileNode = (FileNode) tcTreeNode.getUserObject();
                draggedFileNode.getFile()
                        .renameTo(new File(fn.getFile() + "/" + draggedFileNode.getFile().getName()));
                // update target tree

                testCasePane.parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                TCTreeNode parentTreeNode = (TCTreeNode) tcTargetNode.getParent();
                if (parentTreeNode != null) {
                    parentTreeNode.removeAllChildren();
                    FileNode parentFileNode = (FileNode) parentTreeNode.getUserObject();
                    addTreeToDir(parentFileNode.getFile(), parentTreeNode);
                    ((DefaultTreeModel) getModel()).reload(parentTreeNode);
                } else {
                    tcTargetNode.removeAllChildren();
                    FileNode targetFileNode = (FileNode) tcTargetNode.getUserObject();
                    addTreeToDir(targetFileNode.getFile(), tcTargetNode);
                    ((DefaultTreeModel) getModel()).reload(tcTargetNode);
                }
                // update source tree
                parentTreeNode = (TCTreeNode) tcTreeNode.getParent();
                if (parentTreeNode != null) {
                    parentTreeNode.removeAllChildren();
                    FileNode parentFileNode = (FileNode) parentTreeNode.getUserObject();
                    addTreeToDir(parentFileNode.getFile(), parentTreeNode);
                    ((DefaultTreeModel) getModel()).reload(parentTreeNode);
                } else {
                    tcTreeNode.removeAllChildren();
                    FileNode targetFileNode = (FileNode) tcTreeNode.getUserObject();
                    addTreeToDir(targetFileNode.getFile(), tcTreeNode);
                    ((DefaultTreeModel) getModel()).reload(tcTreeNode);
                }
                testCasePane.parent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                dtde.getDropTargetContext().dropComplete(true);
            } else {
                dtde.rejectDrop();
            }
        } catch (UnsupportedFlavorException ex) {
            logger.error(ex.getMessage());
        } catch (IOException ex) {
            logger.error(ex.getMessage());
        }

    }
}