Example usage for java.awt Cursor DEFAULT_CURSOR

List of usage examples for java.awt Cursor DEFAULT_CURSOR

Introduction

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

Prototype

int DEFAULT_CURSOR

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

Click Source Link

Document

The default cursor type (gets set if no cursor is defined).

Usage

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

private void fireTextUpdateFinished() {
    updateLineBorder();
    reinstallListeners();
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

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

/**
 * Initialize the contents of the frame.
 *///w ww.j  av  a  2  s. co  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:br.ufrgs.enq.jcosmo.ui.COSMOSACDialog.java

private void rebuildSigmaProfiles() {
    if (listModel.getSize() == 0) {
        if (err == true) {
            err = false;// w  w  w  .ja v  a2 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.casemodule.Case.java

/**
 * Creates a new case (create the XML config file and database)
 *
 * @param caseDir    The directory to store case data in. Will be created if
 *                   it doesn't already exist. If it exists, it should have
 *                   all of the needed sub dirs that createCaseDirectory()
 *                   will create.//from  ww  w.j ava2 s  .co m
 * @param caseName   the name of case
 * @param caseNumber the case number
 * @param examiner   the examiner for this case
 * @param caseType   the type of case, single-user or multi-user
 */
public static void create(String caseDir, String caseName, String caseNumber, String examiner,
        CaseType caseType) throws CaseActionException {
    logger.log(Level.INFO, "Creating new case.\ncaseDir: {0}\ncaseName: {1}",
            new Object[] { caseDir, caseName }); //NON-NLS

    // create case directory if it doesn't already exist.
    if (new File(caseDir).exists() == false) {
        Case.createCaseDirectory(caseDir, caseType);
    }

    String configFilePath = caseDir + File.separator + caseName + CASE_DOT_EXTENSION;

    XMLCaseManagement xmlcm = new XMLCaseManagement();

    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss");
    Date date = new Date();
    String santizedCaseName = sanitizeCaseName(caseName);
    String indexName = santizedCaseName + "_" + dateFormat.format(date);
    String dbName = null;

    // figure out the database name and index name for text extraction
    if (caseType == CaseType.SINGLE_USER_CASE) {
        dbName = caseDir + File.separator + "autopsy.db"; //NON-NLS
    } else if (caseType == CaseType.MULTI_USER_CASE) {
        dbName = indexName;
    }

    xmlcm.create(caseDir, caseName, examiner, caseNumber, caseType, dbName, indexName); // create a new XML config file
    xmlcm.writeFile();

    SleuthkitCase db = null;
    try {
        if (caseType == CaseType.SINGLE_USER_CASE) {
            db = SleuthkitCase.newCase(dbName);
        } else if (caseType == CaseType.MULTI_USER_CASE) {
            db = SleuthkitCase.newCase(dbName, UserPreferences.getDatabaseConnectionInfo(), caseDir);
        }
    } catch (TskCoreException ex) {
        logger.log(Level.SEVERE,
                "Error creating a case: " + caseName + " in dir " + caseDir + " " + ex.getMessage(), ex); //NON-NLS
        SwingUtilities.invokeLater(() -> {
            WindowManager.getDefault().getMainWindow()
                    .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        });
        throw new CaseActionException(ex.getMessage(), ex); //NON-NLS
    } catch (UserPreferencesException ex) {
        logger.log(Level.SEVERE, "Error accessing case database connection info", ex); //NON-NLS
        throw new CaseActionException(NbBundle.getMessage(Case.class, "Case.databaseConnectionInfo.error.msg"),
                ex);
    }

    /**
     * Two-stage initialization to avoid leaking reference to "this" in
     * constructor.
     */
    Case newCase = new Case(caseName, caseNumber, examiner, configFilePath, xmlcm, db, caseType);
    changeCase(newCase);
}

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

private void clearLogDataTables() {
    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    try {//w  w  w. jav  a 2  s. co  m
        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.j  a  va  2 s  .c  o  m*/
        clearAfrDataTable(afr1Table);
        clearAfrDataTable(afr2Table);
    } finally {
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
}

From source file:org.openmicroscopy.shoola.agents.metadata.view.MetadataViewerComponent.java

/** 
 * Implemented as specified by the {@link MetadataViewer} interface.
 * @see MetadataViewer#onDataSave(List)/*  w ww .j ava 2  s  .c  o m*/
 */
public void onDataSave(List<DataObject> data) {
    if (data == null)
        return;
    if (model.getState() == DISCARDED)
        return;
    DataObject dataObject = null;
    if (data.size() == 1)
        dataObject = data.get(0);
    if (dataObject != null && model.isSameObject(dataObject)) {
        setRootObject(model.getRefObject(), model.getUserID(), model.getSecurityContext());
        model.setState(READY);
        firePropertyChange(ON_DATA_SAVE_PROPERTY, null, dataObject);
    } else {
        if (model.isSameSelection(data))
            model.setRelatedNodes(data);
        else
            model.setState(READY);
        firePropertyChange(ON_DATA_SAVE_PROPERTY, null, data);
    }
    view.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    fireStateChange();
}

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

public void saveData() {
    if (JFileChooser.APPROVE_OPTION != fileChooser.showSaveDialog(this))
        return;//  ww  w  .  j  a v  a  2  s  .c o  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:com.qspin.qtaste.ui.TestCaseTree.java

public void drop(DropTargetDropEvent dtde) {
    //try/*from  w w  w .j  a v a2 s.  co 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());
        }

    }
}

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);/* w  w  w.j a va2 s  . c  om*/
    } else {
        Cursor normal = new Cursor(Cursor.DEFAULT_CURSOR);
        setCursor(normal);
    }
}