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.isatools.isacreator.spreadsheet.Spreadsheet.java

protected void highlight(String toGroupBy, boolean exactMatch, boolean returnSampleNames) {
    if (tableGroupInformation != null && tableGroupInformation.isShowing()) {
        tableGroupInformation.dispose();
    }/*from   www . ja  va 2  s . com*/

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

    Map<String, List<Object>> groups = getDataGroupsByColumn(toGroupBy, exactMatch, returnSampleNames);

    Map<String, Color> groupColors = new ListOrderedMap<String, Color>();

    for (String s : groups.keySet()) {
        groupColors.put(s, UIHelper.createColorFromString(s, true));
    }
    // then pass the groups and the colours to the TableGroupInfo class to display the gui
    // showing group distribution!
    final Map<Integer, Color> rowColors = paintRows(groups, groupColors);

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

    tableGroupInformation = new TableGroupInfo(groups, groupColors, table.getRowCount());
    tableGroupInformation.setLocation(getWidth() / 2 - tableGroupInformation.getWidth(),
            getHeight() / 2 - tableGroupInformation.getHeight());
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {

            try {
                table.setDefaultRenderer(Class.forName("java.lang.Object"),
                        new CustomRowRenderer(rowColors, UIHelper.VER_11_PLAIN));
                table.repaint();
                tableGroupInformation.createGUI();
                highlightActive = true;
            } catch (ClassNotFoundException e) {
                //
            }
        }
    });
}

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

private void loadLogFile() {
    fileChooser.setMultiSelectionEnabled(false);
    if (JFileChooser.APPROVE_OPTION != fileChooser.showOpenDialog(this))
        return;/*from w  w  w.j  a v  a 2  s  .  c o m*/
    // close log player
    if (logPlayWindow != null)
        disposeLogView();
    // process log file
    File file = fileChooser.getSelectedFile();
    Properties prop = new Properties();
    prop.put("delimiter", ",");
    prop.put("firstRowHasColumnNames", "true");
    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    logDataTable.filter(null);
    filterText.setText("");
    try {
        for (int i = 0; i < logDataTable.getColumnCount(); ++i)
            logDataTable.getTableHeader().removeMouseListener(
                    ((CheckboxHeaderRenderer) logDataTable.getColumn(i).getHeaderRenderer())
                            .getMouseListener());
        logDataTable.refresh(file.toURI().toURL(), prop);
        Column col;
        String colName;
        String lcColName;
        String val;
        CheckboxHeaderRenderer renderer;
        Component comp;
        XYSeries series;
        xAxisColumn.removeAllItems();
        yAxisColumn.removeAllItems();
        plotsColumn.removeAllItems();
        xAxisColumn.addItem("");
        yAxisColumn.addItem("");
        plotsColumn.setText("");
        plot3d.removeAllPlots();
        rpmDataset.removeAllSeries();
        dataset.removeAllSeries();
        xyMarker.clearLabels(true);
        rpmCol = -1;
        displCount = 0;
        selectionCombo.removeAllItems();
        listModel.removeAllElements();
        JTableHeader tableHeader = logDataTable.getTableHeader();
        for (int i = 0; i < logDataTable.getColumnCount(); ++i) {
            col = logDataTable.getColumn(i);
            renderer = new CheckboxHeaderRenderer(i + 1, tableHeader);
            col.setHeaderRenderer(renderer);
            colName = col.getHeaderValue().toString();
            xAxisColumn.addItem(colName);
            yAxisColumn.addItem(colName);
            plotsColumn.addItem(colName);
            comp = renderer.getTableCellRendererComponent(logDataTable.getTable(), colName, false, false, 0, 0);
            col.setPreferredWidth(comp.getPreferredSize().width + 4);
            series = new XYSeries(colName);
            series.setDescription(colName);
            lcColName = colName.toLowerCase();
            dataset.addSeries(series);
            plotRenderer.setSeriesShapesVisible(i, false);
            plotRenderer.setSeriesVisible(i, false);
            selectionCombo.addItem(colName);
            listModel.addElement(new JLabel(colName, renderer.getCheckIcon(), JLabel.LEFT));
            if (rpmDataset.getSeriesCount() == 0
                    && (lcColName.matches(".*rpm.*") || lcColName.matches(".*eng.*speed.*"))) {
                rpmDataset.addSeries(series);
                rpmPlotRenderer.setSeriesShapesVisible(0, false);
                rpmPlotRenderer.setSeriesVisible(0, false);
                rpmCol = i;
            }
            for (int j = 0; j < logDataTable.getRowCount(); ++j) {
                try {
                    val = (String) logDataTable.getValueAt(j, i);
                    series.add(j, Double.valueOf(val), false);
                } catch (Exception e) {
                    JOptionPane.showMessageDialog(null,
                            "Invalid numeric value in column " + colName + ", row " + (j + 1), "Invalid value",
                            JOptionPane.ERROR_MESSAGE);
                    return;
                }
            }
            series.fireSeriesChanged();
        }
        if (logDataTable.getControlPanel().getComponentCount() > 7)
            logDataTable.getControlPanel().remove(7);
        logDataTable.getControlPanel().add(new JLabel("   [" + file.getName() + "]"));
        initColors();
    } catch (Exception ex) {
        ex.printStackTrace();
        logger.error(ex);
    } finally {
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
}

From source file:lejos.pc.charting.LogChartFrame.java

private void selectFolderButton_actionPerformed(ActionEvent e) {
    this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    JFileChooser jfc = new JFileChooser(new File(FQPathTextArea.getText(), ""));
    jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    jfc.setApproveButtonText("Select");
    jfc.setDialogTitle("Select Directory");
    jfc.setDialogType(JFileChooser.OPEN_DIALOG);
    this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    int returnVal = jfc.showOpenDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        FQPathTextArea.setText(getCanonicalName(jfc.getSelectedFile()));
        jfc.setCurrentDirectory(jfc.getSelectedFile());
        System.out.println("folder set to \"" + getCanonicalName(jfc.getSelectedFile()) + "\"");
    }/* w ww .ja v  a 2s.c o m*/
}

From source file:org.gumtree.vis.plot1d.Plot1DPanel.java

@Override
public void mouseReleased(MouseEvent e) {
    if (currentMaskRectangle != null) {
        // reset masking service.
        maskPoint = Double.NaN;// w ww .  j  av a  2 s.  co  m
        currentMaskRectangle = null;
    } else {
        super.mouseReleased(e);
    }
    setMaskDragIndicator(Cursor.DEFAULT_CURSOR);
    this.maskMovePoint = Double.NaN;
}

From source file:cobweb.Cobweb.java

/**
 * Load the neighbourhood (conected nodes) of the given node by sending a
 * request to the server using the defined neighbourhood-script
 * /* ww w. j a  va 2 s.  com*/
 * @param n
 *            The node whose neighbourhood is to be loaded
 */
public void loadNeighbourhood(Node n) {
    if (params.getNeighbourhoodScript() != null) {
        this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
        callJavascriptFunctionStatusMessage("loading neighbourhood for " + n.getName(), true);

        String lines[] = loadStrings(
                params.getServerAdress() + params.getNeighbourhoodScript() + "?id=" + n.getId());
        StringBuffer stringBuf = new StringBuffer();
        for (int i = 0; i < lines.length; i++)
            stringBuf.append(lines[i]);
        String content = stringBuf.toString();

        addNetwork(content, n.getPosition().getX(), n.getPosition().getY());

        this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

        callJavascriptFunctionStatusMessage("loaded neighbourhood for " + n.getName());
    }
}

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

/**
 * This method initializes jMenuItem5   
 *    //w  ww.j a v  a  2  s.  c om
 * @return javax.swing.JMenuItem   
 */
private JMenuItem getJMenuItemQCBarcodes() {
    if (jMenuItemQCBarcodes == null) {
        jMenuItemQCBarcodes = new JMenuItem();
        jMenuItemQCBarcodes.setText("QC Barcodes");
        jMenuItemQCBarcodes.setMnemonic(KeyEvent.VK_B);
        jMenuItemQCBarcodes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
                Singleton.getSingletonInstance().getMainFrame()
                        .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                Singleton.getSingletonInstance().getMainFrame().setStatusMessage("Running barcode QC checks");
                String[] missingBarcodes = SpecimenLifeCycle.getMissingBarcodes();
                ilb = new ImageListBrowser(true);
                if (slb != null) {
                    jPanelCenter.remove(slb);
                }
                if (ulb != null) {
                    jPanelCenter.remove(ulb);
                }
                jPanelCenter.removeAll();
                jPanelCenter.add(ilb, BorderLayout.CENTER);
                jPanelCenter.revalidate();
                jPanelCenter.repaint();
                Singleton.getSingletonInstance().getMainFrame()
                        .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                log.debug(missingBarcodes.length);
                if (missingBarcodes.length > 0) {
                    Counter errorCount = new Counter();
                    for (int i = 0; i < missingBarcodes.length; i++) {
                        BarcodeBuilder builder = Singleton.getSingletonInstance().getBarcodeBuilder();
                        BarcodeMatcher matcher = Singleton.getSingletonInstance().getBarcodeMatcher();
                        String previous = builder.makeFromNumber(matcher.extractNumber(missingBarcodes[i]) - 1);
                        String previousFile = "";
                        String previousPath = "";
                        SpecimenLifeCycle sls = new SpecimenLifeCycle();
                        List<Specimen> result = sls.findByBarcode(previous);
                        if (result != null && (!result.isEmpty())) {
                            Set<ICImage> images = result.get(0).getICImages();

                            if (images != null && (!images.isEmpty())) {
                                Iterator<ICImage> it = images.iterator();
                                if (it.hasNext()) {
                                    ICImage image = it.next();
                                    previousFile = image.getFilename();
                                    previousPath = image.getPath();
                                }
                            }
                        }
                        RunnableJobError err = new RunnableJobError(previousFile, missingBarcodes[i],
                                previousPath, "", "Barcode not found", null, null, null,
                                RunnableJobError.TYPE_BARCODE_MISSING_FROM_SEQUENCE, previousFile,
                                previousPath);
                        errorCount.appendError(err);
                    }
                    String report = "There are at least " + missingBarcodes.length
                            + " barcodes missing from the sequence.\nMissing numbers are shown below.\nIf two or more numbers are missing in sequence, only the first will be listed here.\n\nFiles with mismmatched barcodes are shown in main window.\n";
                    RunnableJobReportDialog errorReportDialog = new RunnableJobReportDialog(
                            Singleton.getSingletonInstance().getMainFrame(), report, errorCount.getErrors(),
                            RunnableJobErrorTableModel.TYPE_MISSING_BARCODES, "QC Barcodes Report");
                    errorReportDialog.setVisible(true);
                } else {
                    JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(),
                            "No barcodes are missing from the sequence.\nAny missmatches are shown in table.",
                            "Barcode QC Report", JOptionPane.OK_OPTION);
                }
                System.gc();
            }
        });
    }
    return jMenuItemQCBarcodes;
}

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

protected void loadLogFile() {
    fileChooser.setMultiSelectionEnabled(true);
    if (JFileChooser.APPROVE_OPTION != fileChooser.showOpenDialog(this))
        return;/*from   ww w .  j av a  2 s.  c  o  m*/
    boolean isPolSet = polfTable.isSet();
    File[] files = fileChooser.getSelectedFiles();
    for (File file : files) {
        BufferedReader br = null;
        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 (logClOlStatusColIdx >= 0 || logAfLearningColIdx >= 0 || logAfCorrectionColIdx >= 0
                        || logAfrColIdx >= 0 || logRpmColIdx >= 0 || logLoadColIdx >= 0 || logTimeColIdx >= 0
                        || logMafvColIdx >= 0 || logIatColIdx >= 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 || logClOlStatusColIdx < 0 || logAfLearningColIdx < 0
                        || logAfCorrectionColIdx < 0 || logAfrColIdx < 0 || logRpmColIdx < 0
                        || logLoadColIdx < 0 || logTimeColIdx < 0 || logMafvColIdx < 0 || logIatColIdx < 0) {
                    ColumnsFiltersSelection selectionWindow = new CLColumnsFiltersSelection(isPolSet);
                    if (!selectionWindow.getUserSettings(elements) || !getColumnsFilters(elements))
                        return;
                }

                String[] flds;
                line = br.readLine();
                int clol;
                int i = 2;
                int row = getLogTableEmptyRow();
                double afr = 0;
                double dVdt = 0;
                double prevTime = 0;
                double time = 0;
                double timeMultiplier = 1.0;
                double pmafv = 0;
                double mafv = 0;
                double load;
                double iat;
                setCursor(new Cursor(Cursor.WAIT_CURSOR));

                while (line != null) {
                    flds = line.split(",", -1);
                    try {
                        // Calculate dV/dt
                        prevTime = time;
                        time = Double.valueOf(flds[logTimeColIdx]);
                        if (timeMultiplier == 1.0 && (int) time - time < 0) {
                            timeMultiplier = 1000.0;
                            prevTime *= timeMultiplier;
                        }
                        time *= timeMultiplier;
                        pmafv = mafv;
                        mafv = Double.valueOf(flds[logMafvColIdx]);
                        if ((time - prevTime) == 0.0)
                            dVdt = 100.0;
                        else
                            dVdt = Math.abs(((mafv - pmafv) / (time - prevTime)) * 1000.0);
                        clol = Integer.valueOf(flds[logClOlStatusColIdx]);
                        if (clol == clValue) {
                            // Filters
                            afr = Double.valueOf(flds[logAfrColIdx]);
                            load = Double.valueOf(flds[logLoadColIdx]);
                            iat = Double.valueOf(flds[logIatColIdx]);
                            if (afrMin <= afr && afr <= afrMax && minLoad <= load && dVdt <= maxDvDt
                                    && maxMafV >= mafv && maxIat >= iat) {
                                Utils.ensureRowCount(row + 1, logDataTable);
                                logDataTable.setValueAt(time, row, 0);
                                logDataTable.setValueAt(load, row, 1);
                                logDataTable.setValueAt(Double.valueOf(flds[logRpmColIdx]), row, 2);
                                logDataTable.setValueAt(mafv, row, 3);
                                logDataTable.setValueAt(afr, row, 4);
                                logDataTable.setValueAt(Double.valueOf(flds[logAfCorrectionColIdx]), row, 5);
                                logDataTable.setValueAt(Double.valueOf(flds[logAfLearningColIdx]), row, 6);
                                logDataTable.setValueAt(dVdt, row, 7);
                                logDataTable.setValueAt(iat, row, 8);
                                row += 1;
                            }
                        }
                    } 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;
                    }
                    line = br.readLine();
                    i += 1;
                }
            }
        } catch (Exception e) {
            logger.error(e);
            JOptionPane.showMessageDialog(null, e, "Error opening file", JOptionPane.ERROR_MESSAGE);
        } finally {
            setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                    logger.error(e);
                }
            }
        }
    }
}

From source file:org.gumtree.vis.plot1d.Plot1DPanel.java

protected int findCursorOnSelectedItem(int x, int y) {
    if (isInternalLegendEnabled && isInternalLegendSelected) {
        Rectangle2D screenArea = getScreenDataArea();
        Rectangle2D legendArea = new Rectangle2D.Double(screenArea.getMaxX() - internalLegendSetup.getMinX(),
                screenArea.getMinY() + internalLegendSetup.getMinY(), internalLegendSetup.getWidth(),
                internalLegendSetup.getHeight());
        Rectangle2D intersect = screenArea.createIntersection(legendArea);
        Point2D point = new Point2D.Double(x, y);
        double minX = legendArea.getMinX();
        double maxX = legendArea.getMaxX();
        double minY = legendArea.getMinY();
        double width = legendArea.getWidth();
        double height = legendArea.getHeight();
        if (!intersect.isEmpty() && screenArea.contains(point)) {
            if (width > 8) {
                Rectangle2D center = new Rectangle2D.Double(minX + 4, minY, width - 8, height);
                if (screenArea.createIntersection(center).contains(point)) {
                    return Cursor.MOVE_CURSOR;
                }//w  w w  . ja va 2s . c o m
            }
            Rectangle2D west = new Rectangle2D.Double(minX - 4, minY, width < 8 ? width / 2 + 4 : 8, height);
            if (screenArea.createIntersection(west).contains(point)) {
                return Cursor.W_RESIZE_CURSOR;
            }
            Rectangle2D east = new Rectangle2D.Double(maxX - (width < 8 ? width / 2 : 4), minY,
                    width < 8 ? width / 2 + 4 : 8, height);
            if (screenArea.createIntersection(east).contains(point)) {
                return Cursor.E_RESIZE_CURSOR;
            }
        }
    } else if (getSelectedMask() != null && !getSelectedMask().isEmpty()) {
        Rectangle2D screenArea = getScreenDataArea();
        Rectangle2D maskArea = ChartMaskingUtilities.getDomainMaskFrame(getSelectedMask(), getScreenDataArea(),
                getChart());
        Rectangle2D intersect = screenArea.createIntersection(maskArea);
        Point2D point = new Point2D.Double(x, y);
        double minX = maskArea.getMinX();
        double maxX = maskArea.getMaxX();
        double minY = maskArea.getMinY();
        double width = maskArea.getWidth();
        double height = maskArea.getHeight();
        if (!intersect.isEmpty() && screenArea.contains(point)) {
            if (width > 8) {
                Rectangle2D center = new Rectangle2D.Double(minX + 4, minY, width - 8, height);
                if (screenArea.createIntersection(center).contains(point)) {
                    return Cursor.MOVE_CURSOR;
                }
            }
            Rectangle2D west = new Rectangle2D.Double(minX - 4, minY, width < 8 ? width / 2 + 4 : 8, height);
            if (screenArea.createIntersection(west).contains(point)) {
                return Cursor.W_RESIZE_CURSOR;
            }
            Rectangle2D east = new Rectangle2D.Double(maxX - (width < 8 ? width / 2 : 4), minY,
                    width < 8 ? width / 2 + 4 : 8, height);
            if (screenArea.createIntersection(east).contains(point)) {
                return Cursor.E_RESIZE_CURSOR;
            }
        }
    }
    return Cursor.DEFAULT_CURSOR;
}

From source file:cobweb.Cobweb.java

/**
 * Handle mouse-released events. Releases the selected node if a node was
 * dragged. If a selection frame was active, the nodes inside the frame are
 * selected./* w  ww  .  jav a2  s .c o  m*/
 */
public void mouseReleased() {
    if (mouseButton == LEFT) {
        if (selectedNode != null) {
            if (!selectedNodeFixed)
                selectedNode.free();
            selectedNode = null;
        } else if (selectionFrame) {
            selectionFrame = false;
            selectNodesByFrame();
        }
    }
    cursor(Cursor.DEFAULT_CURSOR);
}

From source file:us.paulevans.basicxslt.BasicXSLTFrame.java

/**
 * Entry point of threads./*  w ww .  j a v a  2s  . com*/
 */
public void run() {

    String sresultsFile;
    File xmlFile, resultsFile;
    byte results[];

    try {
        switch (threadMode) {
        case THREADMODE_DO_TRANSFORM:
            executeTransform();
            break;
        case THREADMODE_DO_VALIDATE:
            validateXml(label, textField, suppressSuccessDialog);
            break;
        case THREADMODE_DO_XML_IDENTITY_TRANSFORM:
            xmlFile = new File(identityTransformSourceXmlFile);
            sresultsFile = (String) JOptionPane.showInputDialog(this, identityTransformMessage,
                    stringFactory.getString(LabelStringFactory.MAIN_FRAME_IDENTITY_TRANSFORM),
                    JOptionPane.QUESTION_MESSAGE, null, null, identityTransformResultXmlFile);
            if (sresultsFile != null) {
                resultsFile = new File(sresultsFile);
                resultsFile.getParentFile().mkdirs();
                results = XMLUtils.transform(xmlFile, xmlIdentityTransformOutputProps);
                IOUtils.writeFile(resultsFile, results);
            }
            break;
        }
    } catch (Throwable aAny) {
        logger.error(ExceptionUtils.getFullStackTrace(aAny));
        Utils.showErrorDialog(this, aAny);
    } finally {
        Utils.setEnabled(components, true);
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
}