Example usage for java.awt Cursor getPredefinedCursor

List of usage examples for java.awt Cursor getPredefinedCursor

Introduction

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

Prototype

public static Cursor getPredefinedCursor(int type) 

Source Link

Document

Returns a cursor object with the specified predefined type.

Usage

From source file:uk.chromis.pos.forms.JRootApp.java

/**
 *
 */
@Override
public void waitCursorEnd() {
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

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  2  s  .c  om*/

    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:rita.widget.SourceCode.java

public void loadCursor(MouseEvent e) {
    e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}

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

/**
 *
 * @param files//  w w  w  .  ja  v a 2s.c  om
 * @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.openmicroscopy.shoola.agents.treeviewer.browser.BrowserComponent.java

/**
 * Implemented as specified by the {@link Browser} interface.
 * @see Browser#accept(TreeImageDisplayVisitor, int)
 *///w ww  . j  a  v a 2  s.  c o  m
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/*from  ww w. j  a  v a 2 s.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 v  a 2s . c  om
 *
 * @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:org.micromanager.CRISP.CRISPFrame.java

private void CurveButton_ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CurveButton_ActionPerformed
    try {/* w w  w  . j av a  2  s  . c  o  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());
    }
}

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

/**
 * @return//from  w  ww  . jav a  2s .  co  m
 */
private JMenuItem getJMenuItemUsers() {
    if (jMenuItemUsers == null) {
        jMenuItemUsers = new JMenuItem();
        jMenuItemUsers.setText("Users");
        jMenuItemUsers.setMnemonic(KeyEvent.VK_U);
        jMenuItemUsers.setEnabled(false);
        try {
            jMenuItemUsers.setIcon(new ImageIcon(this.getClass()
                    .getResource("/edu/harvard/mcz/imagecapture/resources/people_icon_16px.png")));
        } catch (Exception e) {
            log.error("Can't open icon file for jMenuItemUsers.");
            log.error(e);
        }
        jMenuItemUsers.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
                Singleton.getSingletonInstance().getMainFrame()
                        .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                ulb = new UserListBrowser();
                if (slb != null) {
                    jPanelCenter.remove(slb);
                }
                if (ilb != null) {
                    jPanelCenter.remove(ilb);
                }
                jPanelCenter.removeAll();
                jPanelCenter.add(ulb, BorderLayout.CENTER);
                jPanelCenter.revalidate();
                jPanelCenter.repaint();
                Singleton.getSingletonInstance().getMainFrame()
                        .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
            }
        });
    }
    return jMenuItemUsers;
}

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

/**
 * Gets and visualizes the chart of the Degree Distribution
 *
 * @param evt/* w  w  w. j  a v a2  s.  c  om*/
 */
private void degreeDistributionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_degreeDistributionButtonActionPerformed
    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");
        }
        distributionFrame.setVisible(false);
        distributionFrame = new JFrame();

        scgc = new DegreeSignalCollectGephiConnectorImpl(fileName);
        JFreeChart chart = scgc.createDegreeDistributionChart(scgc.getDegreeDistribution());
        ChartPanel chartPanel = new ChartPanel(chart);
        Dimension dim = new Dimension(750, 450);
        distributionFrame.setMinimumSize(dim);
        distributionFrame.add(chartPanel);
        chartPanel.setVisible(true);
        chartPanel.validate();

        distributionFrame.pack();
        distributionFrame.setVisible(true);
    } 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());
    }
}