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:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.analise_geral.PanelAnaliseGeral.java

private void aplicarATodosActionPerformed() {
    PainelStatusBar.showProgTarReq();//  w ww  .  j a  v  a2  s .  c o  m
    parentFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
    aplicarTod.setEnabled(false);
    int progresso = 0;
    int numLinhas = tableLinCod.getNumLinhas();
    while (tableLinCod.getNumLinhas() > 0) {
        progresso = tableLinCod.getNumLinhas() * 100 / numLinhas;
        PainelStatusBar.setValueProgress(100 - progresso);
        aplicando();
    }
    hashCodeModfcd.add(hashCodAnterior);
    endModfcd.add(enderecoAnterior);
    G_File arq = new G_File("temp/" + ProjetoDoSite.getNomeDoProjeto() + "/reparo/temp/" + hashCodAnterior);
    arq.write(codigoAnterior);
    // FerramentaAnaliseGeralCtrl flc =
    new FerramentaAnaliseGeralCtrl(codigoAnterior, hashCodAnterior);
    boxCode.getTextPane().setText("");
    aplicarTod.setEnabled(true);
    parentFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    salvarPag.setEnabled(false);
    aplicarPag.setEnabled(false);
    aplicarTod.setEnabled(false);
    PainelStatusBar.hideProgTarReq();
}

From source file:org.esa.snap.smart.configurator.ui.PerformancePanel.java

private void sysComputeButtonActionPerformed() {
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    PerformanceParameters optimizedParameters = confOptimizer.computeOptimisedSystemParameters();

    if (VMParameters.canSave()
            && !vmParametersTextField.getText().equals(optimizedParameters.getVMParameters())) {
        vmParametersTextField.setText(optimizedParameters.getVMParameters());
        vmParametersTextField.setForeground(CURRENT_VALUES_COLOR);
        vmParametersTextField.setCaretPosition(0);
    }/*from  w  w w.j a  v  a  2s . co  m*/

    if (!cachePathTextField.getText().equals(optimizedParameters.getCachePath().toString())) {
        cachePathTextField.setText(optimizedParameters.getCachePath().toString());
        cachePathTextField.setForeground(CURRENT_VALUES_COLOR);
    }

    setCursor(Cursor.getDefaultCursor());

    controller.changed();
}

From source file:de.juwimm.cms.content.panel.PanDocuments.java

/**
 *
 * @param files//from   w w  w .  j  a va2  s.  c o  m
 * @param unit
 * @param documentId
 */
public void uploadFiles(File[] files, Integer unit, Integer viewComponentId, Integer documentId) {
    if ((files != null) && (files.length > 0)) {
        for (int i = (files.length - 1); i >= 0; i--) {
            File file = files[i];

            FrmProgressDialog prog = new FrmProgressDialog(
                    Messages.getString("panel.content.documents.addDocument"),
                    Messages.getString("panel.content.upload.ParseFile"), 100);
            prog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            try {
                String fext = Utils.getExtension(file);

                String mimetype = Utils.getMimeType4Extension(fext);
                if (mimetype.equals("")) {
                    mimetype = "application/octet-stream";
                }
                prog.setProgress(Messages.getString("panel.content.upload.Uploading"), 50);
                String password = null;
                if (mimetype.equals("application/pdf") && PdfUtils.isPassswordProtected(file)) {

                    DlgPdfDocumentPassword dlgPdfDocumentPassword = new DlgPdfDocumentPassword(password);
                    dlgPdfDocumentPassword.setSize(350, 280);
                    dlgPdfDocumentPassword.setLocationRelativeTo(UIConstants.getMainFrame());

                    dlgPdfDocumentPassword.setModal(true);
                    dlgPdfDocumentPassword.setVisible(true);
                    dlgPdfDocumentPassword.pack();
                    password = dlgPdfDocumentPassword.getPassword();
                }
                int existingDocId = -1;
                if (unit != null) {
                    existingDocId = comm.getDocumentIdForNameAndUnit(file.getName(), unit);
                } else if (viewComponentId != null) {
                    existingDocId = comm.getDocumentIdForNameAndViewComponent(file.getName(), viewComponentId);
                } else {
                    throw new RuntimeException(
                            "There must be at least one of unitId or viewComponentId present in method call");
                }
                //this.intDocId = this.comm.addOrUpdateDocument(file, unit, file.getName(), mimetype, documentId);
                if (!isDataActualization) {
                    if (existingDocId == 0) {
                        try {
                            DocumentValue documentValue = new DocumentValue();
                            //                        documentValue.setDescription(txtDocumentDescription.getText());
                            documentValue.setDocument(IOUtils.toByteArray(new FileInputStream(file)));
                            documentValue.setDocumentId(documentId);
                            documentValue.setDocumentName(file.getName());
                            //                        documentValue.setLabel(txtDocumentLabel.getText());
                            documentValue.setMimeType(mimetype);
                            documentValue.setPassword(password);
                            //                        documentValue.setSearchable(ckbDocumentSearchable.isSelected());
                            documentValue.setUnitId(unit);
                            documentValue.setViewDocumentId(viewComponentId);
                            this.intDocId = this.comm.addOrUpdateDocument(documentValue).getDocumentId();
                        } catch (InvalidSizeException e) {
                            JOptionPane.showMessageDialog(UIConstants.getMainFrame(), e.getMessage(),
                                    rb.getString("dialog.title"), JOptionPane.INFORMATION_MESSAGE);
                            return;
                        }
                    } else {
                        DlgSaveDocument saveDialog = new DlgSaveDocument(file, unit, file.getName(), mimetype,
                                existingDocId);
                        int frameHeight = 280;
                        int frameWidth = 350;
                        saveDialog.setSize(frameWidth, frameHeight);
                        saveDialog.setLocationRelativeTo(UIConstants.getMainFrame());
                        saveDialog.setModal(true);
                        saveDialog.setVisible(true);
                    }
                } else {
                    if ((existingDocId == 0) || (file.getName().equalsIgnoreCase(selectedDocName))) {
                        try {
                            DocumentValue documentValue = new DocumentValue();
                            documentValue.setDescription(txtDocumentDescription.getText());
                            documentValue.setDocument(IOUtils.toByteArray(new FileInputStream(file)));
                            documentValue.setDocumentId(documentId);
                            documentValue.setDocumentName(file.getName());
                            documentValue.setLabel(txtDocumentLabel.getText());
                            documentValue.setMimeType(mimetype);
                            documentValue.setPassword(password);
                            documentValue.setSearchable(ckbDocumentSearchable.isSelected());
                            documentValue.setAuthor(txtAuthor.getText());
                            documentValue.setCategory(txtCategory.getText());
                            documentValue.setUnitId(unit);
                            documentValue.setViewDocumentId(viewComponentId);
                            this.intDocId = this.comm.addOrUpdateDocument(documentValue).getDocumentId();
                        } catch (InvalidSizeException e) {
                            JOptionPane.showMessageDialog(UIConstants.getMainFrame(), e.getMessage(),
                                    rb.getString("dialog.title"), JOptionPane.INFORMATION_MESSAGE);
                            return;
                        }
                    } else if ((existingDocId != 0) && (!file.getName().equalsIgnoreCase(selectedDocName))) {
                        JOptionPane.showMessageDialog(UIConstants.getMainFrame(),
                                Messages.getString("dialog.saveDocument.imposibleToOverwrite"),
                                rb.getString("dialog.title"), JOptionPane.INFORMATION_MESSAGE);
                    }
                }

            } catch (Exception exe) {
                log.error("Error upload document " + file.getName(), exe);
            } finally {
                prog.setProgress(Messages.getString("panel.content.upload.Finished"), 100);
                prog.dispose();
                prog.setCursor(Cursor.getDefaultCursor());
            }
        }
    }
}

From source file:org.giswater.controller.MenuController.java

public void downloadNewVersion() {

    Utils.getLogger().info("Downloading last version...");

    if (ftp == null)
        return;//from ww  w.  j ava  2  s .c o  m

    String ftpVersion = ftp.getFtpVersion();
    String remoteName = UPDATE_FILE + ftpVersion + ".exe";
    // Choose file to download
    mainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
    String localePath = chooseFileSetup(remoteName);
    if (!localePath.equals("")) {
        DownloadPanel panel = new DownloadPanel(remoteName, localePath, ftp);
        JDialog downloadDialog = Utils.openDialogForm(panel, mainFrame,
                Utils.getBundleString("MenuController.download_process"), 290, 135); //$NON-NLS-1$
        downloadDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
        downloadDialog.setVisible(true);
        mainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }

}

From source file:org.geworkbench.engine.ccm.ComponentConfigurationManagerWindow2.java

/**
 * Persist users component selections //from w  w  w  . ja va 2 s.co  m
 * Add newly selected components 
 * Remove newly unselected components Leave CCM Window open
 * 
 * @param ActionEvent
 * @return void
 */
private void applyCcmSelections_actionPerformed(ActionEvent e) {
    Cursor hourglassCursor = new Cursor(Cursor.WAIT_CURSOR);
    frame.setCursor(hourglassCursor);

    for (int i = 0; i < ccmTableModel.getModelRowCount(); i++) {

        boolean choice = ((Boolean) ccmTableModel.getModelValueAt(i, CCMTableModel2.SELECTION_INDEX))
                .booleanValue();

        boolean originalChoice = this.originalChoices.get(i).booleanValue();
        /* No change in selection */
        if (choice == originalChoice) {
            continue;
        }

        String resource = ccmTableModel.getResourceFolder(i);
        File file = ccmTableModel.getFile(i);
        String filename = file.getName();

        String propFileName = null;
        if (filename.endsWith(".cwb.xml")) {
            propFileName = filename.replace(".cwb.xml", ".ccmproperties");
        } else {
            log.error("File name is " + filename + " when .cwb.xml file is expected");
            continue;
        }
        String sChoice = (new Boolean(choice)).toString();

        ComponentConfigurationManager.writeProperty(resource, propFileName, "on-off", sChoice);

        if (choice) {
            manager.componentConfigurationManager.loadComponent(file);
            continue;
        }

        /* Remove Component */
        manager.componentConfigurationManager.removeComponent(resource, file.getAbsolutePath());

        ccmTableModel.fireTableDataChanged();
        if (textPane.getCaretPosition() > 1) {
            textPane.setCaretPosition(1);
        }
    }

    ProjectPanel.getInstance().ccmUpdate();

    setOriginalChoices();

    Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
    frame.setCursor(normalCursor);
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.browser.BrowserComponent.java

/**
 * Implemented as specified by the {@link Browser} interface.
 * @see Browser#accept(TreeImageDisplayVisitor, int)
 *//* w w  w . j ava  2  s  .c om*/
public void accept(TreeImageDisplayVisitor visitor, int algoType) {
    view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    view.getTreeRoot().accept(visitor, algoType);
    view.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

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

/**
 * Gets the properties of the current graph by clicking on the property
 * button// w  w w .  j  ava 2s .  c o  m
 *
 * @param evt
 */
private void propertyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_propertyButtonActionPerformed
    try {

        mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        if (jTextArea1.getText() == null) {
            throw new IllegalArgumentException("No file was chosen!\nPlease choose a valid .gml file");
        }
        if (!jTextArea1.getText().contains(".gml")) {
            throw new IllegalArgumentException(
                    "The chosen file doesn't have the right format!\nPlease choose a valid .gml file");
        }

        if (scgc == null || !scgc.getFileName().equals(fileName)) {
            scgc = new DegreeSignalCollectGephiConnectorImpl(fileName);
        }
        propertyContentDisplay.setText(setPropertyText(scgc.getGraphProperties()));
    } catch (IllegalArgumentException exception) {

        messageFrame = new JFrame();
        JOptionPane.showMessageDialog(messageFrame, 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 {
        mainPanel.setCursor(Cursor.getDefaultCursor());
    }
}

From source file:com.codejumble.opentube.Main.java

/**
 * Updates the download manager with a new link, if the manager hasn't
 * started it will be initialized./*from ww w  . ja va  2  s.c o m*/
 *
 * @param url URL address to add
 */
private void updateDownloadManagerWithNewURL(String url) {
    videoURLDownloadButton.setEnabled(false);
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    try {
        if (isWaitingForTasks() && defaultDownloadManager.getState().equals(SwingWorker.StateValue.DONE)) {
            defaultDownloadManager = new DownloadManager(this, tmpFilesFolder,
                    configuredFolderForDownloadedMedia);
        }
        defaultDownloadManager.addDownloadToQueue(url, fileNameField.getText(), getSelectedFormatOption());
        defaultDownloadManager.execute();

    } catch (MalformedURLException ex) {
        createErrorDialog(this, "The inputted URL doesn't match a valid format", "Wrong URL format");
    } catch (RuntimeException ex) {
        createErrorDialog(this, "The provided website is not supported", "Unsupported website");
    } catch (Exception e) {
        createErrorDialog(this, e.getMessage(), "Unexpected error");
    }
    videoURLDownloadButton.setEnabled(true);
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    resetVideoFileName();
}

From source file:gov.nih.nci.nbia.StandaloneDMV3.java

private void submitRequest(String userId, String password) {
    Cursor waitCursor = new Cursor(Cursor.WAIT_CURSOR);
    Cursor defaultCursor = new Cursor(Cursor.DEFAULT_CURSOR);
    frame.setCursor(waitCursor);/* w w  w.j a  v a  2  s .  c o  m*/
    submitUserCredential(userId, password);
    frame.setCursor(defaultCursor);
}

From source file:org.micromanager.CRISP.CRISPFrame.java

private void CurveButton_ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CurveButton_ActionPerformed
    try {//from w  w  w.  j  a v a  2s.co  m
        core_.enableContinuousFocus(false);
        // TODO: emulate pressing Zero button

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

        core_.setProperty(CRISP_, "Obtain Focus Curve", "Do it");
        int index = 0;
        String vals = "";
        while (core_.hasProperty(CRISP_, "Focus Curve Data" + index)) {
            vals += core_.getProperty(CRISP_, "Focus Curve Data" + index);
            index++;
        }

        XYSeries data = new XYSeries("");
        String[] valLines = vals.split("\r\n");
        for (int i = 0; i < valLines.length; i++) {
            String[] tokens = valLines[i].split("\\s+");
            data.add(Float.parseFloat(tokens[2]), Integer.parseInt(tokens[3]));
        }

        String na = core_.getProperty(CRISP_, "Objective NA");
        plotData("CRISP Focus Curve, for NA=" + na, data, "Z-position(microns)", "Focus Error Signal", 200,
                200);

    } catch (Exception ex) {
        ReportingUtils.showError("Problem acquiring focus curve");
    } finally {
        setCursor(Cursor.getDefaultCursor());
    }
}