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.argouml.application.Main.java

/**
 * Do a part of the initialization that is very much GUI-stuff.
 *
 * @param splash the splash screeen/*from  ww  w.jav  a2s  .  c  o m*/
 */
private static ProjectBrowser initializeGUI(SplashScreen splash) {
    // make the projectbrowser
    JPanel todoPane = new ToDoPane();
    ProjectBrowser pb = ProjectBrowser.makeInstance(splash, true, todoPane);

    JOptionPane.setRootFrame(pb);

    pb.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    // Set the screen layout to what the user left it before, or
    // to reasonable defaults.
    Rectangle scrSize = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();

    int configFrameWidth = Configuration.getInteger(Argo.KEY_SCREEN_WIDTH, scrSize.width);
    int w = Math.min(configFrameWidth, scrSize.width);
    if (w == 0) {
        w = 600;
    }

    int configFrameHeight = Configuration.getInteger(Argo.KEY_SCREEN_HEIGHT, scrSize.height);
    int h = Math.min(configFrameHeight, scrSize.height);
    if (h == 0) {
        h = 400;
    }

    int x = Configuration.getInteger(Argo.KEY_SCREEN_LEFT_X, 0);
    int y = Configuration.getInteger(Argo.KEY_SCREEN_TOP_Y, 0);
    pb.setLocation(x, y);
    pb.setSize(w, h);
    pb.setExtendedState(
            Configuration.getBoolean(Argo.KEY_SCREEN_MAXIMIZED, false) ? Frame.MAXIMIZED_BOTH : Frame.NORMAL);

    UIManager.put("Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "ENTER", "pressed",
            "released ENTER", "released", "SPACE", "pressed", "released SPACE", "released" }));
    return pb;
}

From source file:com.josescalia.tumblr.form.TumblrImageViewer.java

private void btnAddToCollectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddToCollectionActionPerformed
    frame = (MainFrame) this.getTopLevelAncestor();
    form = this;/*from   ww  w . j  av a2  s . c om*/
    if (validateUrl()) {
        final Rss rss = constructNewObject();

        if (rss != null) {
            //set Progressbar and cursor
            form.setCursor(new Cursor(Cursor.WAIT_CURSOR));
            frame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
            frame.startProgressBar("Saving");

            new SwingWorker<Boolean, Boolean>() {
                @Override
                protected Boolean doInBackground() throws Exception {
                    try {
                        rssService.save(rss);
                        return Boolean.TRUE;
                    } catch (Exception e) {
                        UIAlert.showError(null, UIMessageConstants.saveFailedMsg + "\n" + e.getMessage());
                    }
                    return Boolean.FALSE;
                }

                protected void done() {
                    try {
                        if (get()) {
                            UIAlert.showInformation(null, UIMessageConstants.saveSucceedMsg);
                        } else {
                            UIAlert.showInformation(null, UIMessageConstants.saveFailedMsg);
                        }
                    } catch (InterruptedException e) {
                        logger.error(e);
                    } catch (ExecutionException e) {
                        logger.error(e);
                    }
                    form.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                    frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                    frame.stopProgressBar("");
                }
            }.execute();

        }
    }
}

From source file:com.signalcollect.sna.visualization.SignalCollectSNATopComponent.java

/**
 * Executes the label propagation algorithm
 *
 * @param evt//  w  ww . j  a  v a2s.co m
 */
private void labelPropagationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_labelPropagationButtonActionPerformed
    try {
        mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        if (jTextPane1.getText() == null) {
            throw new IllegalArgumentException("No input found!");
        }
        if (Integer.parseInt(jTextPane1.getText()) < 1) {
            throw new IllegalArgumentException("The number has to be greater than 0");
        }
        scgc = new LabelPropagationSignalCollectGephiConnectorImpl(fileName,
                scala.Option.apply(Integer.parseInt(jTextPane1.getText())));

        scgc.getLabelPropagation();
    } catch (IllegalArgumentException exception) {

        JOptionPane.showMessageDialog(messageFrame,
                "Error when parsing input " + jTextPane1.getText() + ": " + exception.getMessage(),
                "Signal/Collect Error", JOptionPane.ERROR_MESSAGE);

    } catch (Exception exception) {
        messageFrame = new JFrame();
        exception.printStackTrace();
        JOptionPane.showMessageDialog(messageFrame,
                "Technical exception happened (" + exception.getCause() + ")", "Signal/Collect Error",
                JOptionPane.ERROR_MESSAGE);
    } finally {
        scgc = null;
        mainPanel.setCursor(Cursor.getDefaultCursor());
    }

}

From source file:com.nbt.TreeFrame.java

public void doImportDat(final File file) {
    Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
    setCursor(waitCursor);//from  w  w w  .  jav  a  2s .  c o  m

    SwingWorkerUnlimited.execure(new SwingWorker<CompoundTag, Void>() {

        @Override
        protected CompoundTag doInBackground() throws Exception {
            NBTInputStream ns = null;
            try {
                ns = new NBTInputStream(new FileInputStream(file));
                return (CompoundTag) ns.readTag();
            } finally {
                IOUtils.closeQuietly(ns);
            }
        }

        @Override
        protected void done() {
            CompoundTag tag = null;
            try {
                tag = get();
            } catch (InterruptedException e) {
                e.printStackTrace();
            } catch (ExecutionException e) {
                e.printStackTrace();
                Throwable cause = ExceptionUtils.getRootCause(e);
                showErrorDialog(cause.getMessage());
                return;
            }
            textFile.setText(file.getAbsolutePath());

            updateTreeTable(tag);

            Cursor defaultCursor = Cursor.getDefaultCursor();
            setCursor(defaultCursor);
        }

    });
}

From source file:edu.harvard.mcz.imagecapture.MainFrame.java

public void setSpecimenBrowseList(Specimen searchCriteria) {
    Singleton.getSingletonInstance().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    slb = new SpecimenBrowser(searchCriteria, true);
    if (ilb != null) {
        jPanelCenter.remove(ilb);//from www.j  av a2s  .c  o  m
    }
    if (ulb != null) {
        jPanelCenter.remove(ulb);
    }
    jPanelCenter.removeAll();
    jPanelCenter.add(slb, BorderLayout.CENTER);
    jPanelCenter.revalidate();
    jPanelCenter.repaint();
    if (Singleton.getSingletonInstance().getProperties().getProperties()
            .getProperty(ImageCaptureProperties.KEY_ENABLE_BROWSE).equals("false")) {
        jMenuItemBrowseSpecimens.setEnabled(false);
        jMenuItemBrowseImages.setEnabled(false);
    } else {
        jMenuItemBrowseSpecimens.setEnabled(true);
        jMenuItemBrowseImages.setEnabled(true);
    }
    setStatusMessage("Found " + slb.getRowCount() + " matching specimens");
    Singleton.getSingletonInstance().getMainFrame()
            .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:com.ixora.rms.ui.RMSFrame.java

/**
 * Handles the new session event.//from w ww.  ja va  2  s  . c  om
 */
private void handleNewMonitoringSession() {
    try {
        // try to close current view
        if (resetCurrentView()) {
            return;
        }
        // run this job synchronously as
        // it does UI work
        this.fWorker.runJobSynch(new UIWorkerJobDefault(this, Cursor.WAIT_CURSOR,
                MessageRepository.get(Msg.TEXT_BEGININGNEWSESSION)) {
            public void work() throws Throwable {
                fCurrentView = new LiveSessionView(getHostMonitor(), fMonitoringSessionRepository, null,
                        RMSFrame.this);
            }

            public void finished(Throwable ex) {
                if (ex != null) {
                    resetCurrentView();
                }
            }
        });
        if (fCurrentView != null) {
            fCurrentView.initialize();
        }
    } catch (Exception e) {
        resetCurrentView();
        UIExceptionMgr.userException(e);
    }
}

From source file:org.jets3t.apps.cockpitlite.CockpitLite.java

/**
 * Starts a progress display dialog. While the dialog is running the user cannot interact
 * with the application, except to cancel the task.
 *
 * @param statusMessage//  w ww.ja  va  2 s.c  o m
 *        describes the status of a task text meaningful to the user, such as "3 files of 7 uploaded"
 * @param detailsText
 *        describes the status of a task in more detail, such as the current transfer rate and Time remaining.
 * @param minTaskValue  the minimum progress value for a task, generally 0
 * @param maxTaskValue
 *        the maximum progress value for a task, such as the total number of threads or 100 if
 *        using percentage-complete as a metric.
 * @param cancelEventListener
 *        listener that is responsible for cancelling a long-lived task when the user clicks
 *        the cancel button. If a task cannot be cancelled this must be null.
 * @param cancelButtonText
 *        text displayed in the cancel button if a task can be cancelled. This is only used if
 *        a cancel event listener is provided.
 */
private void startProgressDialog(final String statusMessage, final String detailsText, final int minTaskValue,
        final int maxTaskValue, final String cancelButtonText, final CancelEventTrigger cancelEventListener) {
    if (this.progressDialog == null) {
        this.progressDialog = new ProgressDialog(this.ownerFrame, "Please wait...",
                cockpitLiteProperties.getProperties());
    }

    this.getContentPane().setCursor(new Cursor(Cursor.WAIT_CURSOR));

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            progressDialog.startDialog(statusMessage, detailsText, minTaskValue, maxTaskValue,
                    cancelEventListener, cancelButtonText);
        }
    });
}

From source file:com.nbt.TreeFrame.java

public void doImportMCR(final File file) {
    Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
    setCursor(waitCursor);//from   w  w  w .  j a v  a2s .  c om

    SwingWorkerUnlimited.execure(new SwingWorker<Region, Void>() {

        @Override
        protected Region doInBackground() throws Exception {
            NBTRegion region = new NBTRegion(file);
            region.getChunks(); // load from disk
            return region;
        }

        @Override
        protected void done() {
            Region region = null;
            try {
                region = get();
            } catch (InterruptedException e) {
                e.printStackTrace();
            } catch (ExecutionException e) {
                e.printStackTrace();
                Throwable cause = ExceptionUtils.getRootCause(e);
                showErrorDialog(cause.getMessage());
                return;
            }
            textFile.setText(file.getAbsolutePath());

            updateTreeTable(region);

            Cursor defaultCursor = Cursor.getDefaultCursor();
            setCursor(defaultCursor);
        }

    });
}

From source file:com.josescalia.tumblr.form.TumblrImageViewer.java

private void btnLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadActionPerformed
    frame = (MainFrame) this.getTopLevelAncestor();
    form = this;/*from w w w . j  a v a  2 s . c o m*/

    //busy cursor and progress bar in frame and panel
    form.setCursor(new Cursor(Cursor.WAIT_CURSOR));
    frame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
    frame.startProgressBar("Processing");

    new SwingWorker<JDialog, JDialog>() {
        @Override
        protected JDialog doInBackground() throws Exception {
            return new TumblrFavLinkListDialog(null, true);
        }

        @Override
        protected void done() {
            TumblrFavLinkListDialog dlg = null;
            String urlToFetch = "";
            try {
                dlg = (TumblrFavLinkListDialog) get();
                dlg.showDialog();
            } catch (InterruptedException e) {
                logger.error(e);
            } catch (ExecutionException e) {
                logger.error(e);
            }
            if (dlg != null) {
                form.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                frame.stopProgressBar("");
                urlToFetch = dlg.getFieldText();
            }
            if (!urlToFetch.equals("")) {
                setUrl(urlToFetch);
            }
        }
    }.execute();

}

From source file:org.fhaes.gui.AnalysisResultsPanel.java

/**
 * Draw the analysis results table depending on the current tree-node forcing the GUI to refresh regardless
 * /*w  w  w .j  a v  a2  s . c o  m*/
 * @param forceRefresh
 */
public void setupTable(Boolean forceRefresh) {

    cl.show(cards, RESULTSPANEL);
    MainWindow.getInstance().getReportPanel().actionResultsHelp.setEnabled(true);

    goldFishPanel.setParamsText();

    try {
        log.debug("Setting cursor to wait");
        table.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        treeResults.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

        DefaultMutableTreeNode selectednode = (DefaultMutableTreeNode) treeResults
                .getLastSelectedPathComponent();

        if (selectednode == null) {
            clearTable();
            return;
        }

        log.debug("Node selected: " + selectednode.toString());

        // If selection hasn't changed don't do anything
        if (previouslySelectedNode != null && selectednode.equals(previouslySelectedNode) && !forceRefresh) {
            log.debug("Node selection hasn't changed so not doing anything");
            return;
        }

        previouslySelectedNode = selectednode;

        if (!(selectednode instanceof FHAESResultTreeNode)) {
            clearTable();
            return;
        }

        FHAESResultTreeNode resultnode = (FHAESResultTreeNode) treeResults.getLastSelectedPathComponent();

        FHAESResult result = resultnode.getFHAESResult();
        panelResult.setBorder(new TitledBorder(null, result.getFullName(), TitledBorder.LEADING,
                TitledBorder.TOP, null, null));

        if (result.equals(FHAESResult.SEASONALITY_SUMMARY)) {

            log.debug("Seasonality summary node selected");

            if (seasonalitySummaryModel == null) {
                clearTable();
                return;
            }

            table.setModel(seasonalitySummaryModel);
            // table.setSortOrder(0, SortOrder.ASCENDING);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        }

        else if (result.equals(FHAESResult.INTERVAL_SUMMARY)) {

            log.debug("Interval summary node selected");

            if (intervalsSummaryModel == null) {
                clearTable();
                return;
            }

            table.setModel(intervalsSummaryModel);
            // table.setSortOrder(0, SortOrder.ASCENDING);
            setDefaultTableAlignment(SwingConstants.RIGHT);

        }

        else if (result.equals(FHAESResult.INTERVAL_EXCEEDENCE_TABLE)) {

            log.debug("Interval exceedence node selected");

            if (intervalsExceedenceModel == null) {
                clearTable();
                return;
            }

            table.setModel(intervalsExceedenceModel);
            // table.setSortOrder(0, SortOrder.ASCENDING);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        }

        else if (result.equals(FHAESResult.BINARY_MATRIX_00)) {

            if (this.bin00Model == null) {
                clearTable();
                return;
            }

            table.setModel(bin00Model);
            // table.setSortOrder(0, SortOrder.ASCENDING);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        }

        else if (result.equals(FHAESResult.BINARY_MATRIX_01)) {

            if (this.bin01Model == null) {
                clearTable();
                return;
            }

            table.setModel(bin01Model);
            // table.setSortOrder(0, SortOrder.ASCENDING);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        }

        else if (result.equals(FHAESResult.BINARY_MATRIX_10)) {

            if (this.bin10Model == null) {
                clearTable();
                return;
            }

            table.setModel(bin10Model);
            // table.setSortOrder(0, SortOrder.ASCENDING);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.BINARY_MATRIX_11)) {

            if (this.bin11Model == null) {
                clearTable();
                return;
            }

            table.setModel(bin11Model);
            // table.setSortOrder(0, SortOrder.ASCENDING);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.BINARY_MATRIX_SUM)) {

            if (this.binSumModel == null) {
                clearTable();
                return;
            }
            table.setModel(binSumModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.JACCARD_SIMILARITY_MATRIX)) {

            if (this.SJACModel == null) {
                clearTable();
                return;
            }
            table.setModel(SJACModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.COHEN_SIMILARITITY_MATRIX)) {

            if (this.SCOHModel == null) {
                clearTable();
                return;
            }
            table.setModel(SCOHModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.JACCARD_SIMILARITY_MATRIX_D)) {

            if (this.DSJACModel == null) {
                clearTable();
                return;
            }
            table.setModel(DSJACModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.COHEN_SIMILARITITY_MATRIX_D)) {

            if (this.DSCOHModel == null) {
                clearTable();
                return;
            }
            table.setModel(DSCOHModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.BINARY_MATRIX_NTP)) {

            log.debug("doing NTP");
            if (this.NTPModel == null) {
                log.debug("fileNTP is null so clearing table");

                clearTable();
                return;
            }
            table.setModel(NTPModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.BINARY_MATRIX_SITE)) {

            if (this.siteSummaryModel == null) {
                clearTable();
                return;
            }
            table.setModel(siteSummaryModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.BINARY_MATRIX_TREE)) {

            if (this.treeSummaryModel == null) {
                clearTable();
                return;
            }
            table.setModel(treeSummaryModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        }

        else if (result.equals(FHAESResult.GENERAL_SUMMARY)) {

            if (this.generalSummaryModel == null) {
                clearTable();
                return;
            }
            table.setModel(generalSummaryModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        }

        else if (result.equals(FHAESResult.SINGLE_FILE_SUMMARY)) {

            if (this.singleFileSummaryModel == null) {
                clearTable();
                return;
            }
            table.setModel(singleFileSummaryModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        }

        else if (result.equals(FHAESResult.SINGLE_EVENT_SUMMARY)) {

            if (this.singleEventSummaryModel == null) {
                clearTable();
                return;
            }
            table.setModel(singleEventSummaryModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
            setTableColumnAlignment(SwingConstants.LEFT, 2);
        }

        else {
            log.warn("Unhandled FHAESResult type");
            clearTable();
        }

        table.packAll();

        table.setColumnControlVisible(true);
        table.setAutoCreateRowSorter(true);

    } catch (Exception e) {
        log.debug("Caught exception loading table data");

    } finally {
        log.debug("Clearing cursor");

        table.setCursor(Cursor.getDefaultCursor());
        treeResults.setCursor(Cursor.getDefaultCursor());
    }

}