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.ut.biolab.medsavant.client.filter.TagFilterView.java

public TagFilterView(int queryID) {
    super(FILTER_NAME, queryID);

    setLayout(new BorderLayout());
    setBorder(ViewUtil.getBigBorder());/*ww w .j  ava 2s  . c  o m*/
    setMaximumSize(new Dimension(200, 80));

    JPanel cp = new JPanel();
    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    c.gridx = 0;
    c.gridy = 0;

    cp.setLayout(gbl);

    variantTags = new ArrayList<VariantTag>();
    appliedTags = new ArrayList<VariantTag>();

    clear = new JButton("Clear");
    applyButton = new JButton("Apply");

    try {
        final JComboBox tagNameCB = new JComboBox();
        //tagNameCB.setMaximumSize(new Dimension(1000,30));

        final JComboBox tagValueCB = new JComboBox();
        //tagValueCB.setMaximumSize(new Dimension(1000,30));

        JPanel bottomContainer = new JPanel();
        ViewUtil.applyHorizontalBoxLayout(bottomContainer);

        List<String> tagNames = MedSavantClient.VariantManager
                .getDistinctTagNames(LoginController.getSessionID());

        for (String tag : tagNames) {
            tagNameCB.addItem(tag);
        }

        ta = new JTextArea();
        ta.setRows(10);
        ta.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        ta.setEditable(false);

        applyButton.setEnabled(false);

        JLabel addButton = ViewUtil
                .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.ADD));
        addButton.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {

                if (tagNameCB.getSelectedItem() == null || tagValueCB.getSelectedItem() == null) {
                    return;
                }

                VariantTag tag = new VariantTag((String) tagNameCB.getSelectedItem(),
                        (String) tagValueCB.getSelectedItem());
                if (variantTags.isEmpty()) {
                    ta.append(tag.toString() + "\n");
                } else {
                    ta.append("AND " + tag.toString() + "\n");
                }
                variantTags.add(tag);
                applyButton.setEnabled(true);
            }
        });

        clear.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                variantTags.clear();
                ta.setText("");
                applyButton.setEnabled(true);
            }
        });

        int width = 150;

        ta.setPreferredSize(new Dimension(width, width));
        ta.setMaximumSize(new Dimension(width, width));
        tagNameCB.setPreferredSize(new Dimension(width, 25));
        tagValueCB.setPreferredSize(new Dimension(width, 25));
        tagNameCB.setMaximumSize(new Dimension(width, 25));
        tagValueCB.setMaximumSize(new Dimension(width, 25));

        cp.add(new JLabel("Name"), c);
        c.gridx++;
        cp.add(tagNameCB, c);
        c.gridx++;

        c.gridx = 0;
        c.gridy++;

        cp.add(new JLabel("Value"), c);
        c.gridx++;
        cp.add(tagValueCB, c);
        c.gridx++;
        cp.add(addButton, c);

        tagNameCB.addItemListener(new ItemListener() {

            @Override
            public void itemStateChanged(ItemEvent ie) {
                updateTagValues((String) tagNameCB.getSelectedItem(), tagValueCB);
            }
        });

        if (tagNameCB.getItemCount() > 0) {
            tagNameCB.setSelectedIndex(0);
            updateTagValues((String) tagNameCB.getSelectedItem(), tagValueCB);
        }

        al = new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {

                applyButton.setEnabled(false);

                appliedTags = new ArrayList<VariantTag>(variantTags);

                Filter f = new Filter() {

                    @Override
                    public Condition[] getConditions() {
                        try {
                            List<Integer> uploadIDs = MedSavantClient.VariantManager
                                    .getUploadIDsMatchingVariantTags(LoginController.getSessionID(),
                                            TagFilterView.tagsToStringArray(variantTags));

                            Condition[] uploadIDConditions = new Condition[uploadIDs.size()];

                            TableSchema table = MedSavantClient.CustomTablesManager.getCustomTableSchema(
                                    LoginController.getSessionID(),
                                    MedSavantClient.ProjectManager.getVariantTableName(
                                            LoginController.getSessionID(),
                                            ProjectController.getInstance().getCurrentProjectID(),
                                            ReferenceController.getInstance().getCurrentReferenceID(), true));

                            for (int i = 0; i < uploadIDs.size(); i++) {
                                uploadIDConditions[i] = BinaryCondition.equalTo(
                                        table.getDBColumn(BasicVariantColumns.UPLOAD_ID), uploadIDs.get(i));
                            }

                            return new Condition[] { ComboCondition.or(uploadIDConditions) };
                        } catch (Exception ex) {
                            ClientMiscUtils.reportError("Error getting upload IDs: %s", ex);
                        }
                        return new Condition[0];
                    }

                    @Override
                    public String getName() {
                        return FILTER_NAME;
                    }

                    @Override
                    public String getID() {
                        return FILTER_ID;
                    }
                };
                FilterController.getInstance().addFilter(f, TagFilterView.this.queryID);
            }
        };

        applyButton.addActionListener(al);

        bottomContainer.add(Box.createHorizontalGlue());
        bottomContainer.add(clear);
        bottomContainer.add(applyButton);

        add(ViewUtil.getClearBorderedScrollPane(ta), BorderLayout.CENTER);
        add(bottomContainer, BorderLayout.SOUTH);

    } catch (Exception ex) {
        ClientMiscUtils.checkSQLException(ex);
    }

    add(cp, BorderLayout.NORTH);

    this.showViewCard();
}

From source file:org.kalypso.kalypsomodel1d2d.ui.map.channeledit.DrawBanklineWidget.java

@Override
public void mouseMoved(final MouseEvent event) {
    final Point p = event.getPoint();
    if (p == null)
        return;//  w  w w  . ja  v  a  2 s . com

    final IMapPanel mapPanel = getMapPanel();
    if (mapPanel == null)
        return;

    m_currentPos = MapUtilities.transform(getMapPanel(), p);

    if (m_edit && m_bankline != null)
        m_lineEditor.moved(m_currentPos);
    else
        getMapPanel().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

    repaintMap();
}

From source file:org.kalypso.kalypsomodel1d2d.ui.map.channeledit.LineGeometryEditor.java

public void moved(final GM_Point p) {
    m_startPoint = null;// w  w w  . ja  va 2  s .co m

    final GM_Point movedPoint = m_pointSnapper.moved(p);
    if (movedPoint != null) {
        m_curve = m_positionMap.get(movedPoint.getPosition());

        m_handles = collectHandles();

        m_mapPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else
        m_mapPanel.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

    repaintMap();
}

From source file:org.pentaho.reporting.designer.extensions.pentaho.repository.actions.PublishToServerTask.java

public void run() {
    final MasterReport report = reportDesignerContext.getActiveContext().getContextRoot();
    final DocumentMetaData metaData = report.getBundle().getMetaData();

    try {//from   w ww. j  a  va 2s. co m
        final String oldName = extractLastFileName(report);

        SelectFileForPublishTask selectFileForPublishTask = new SelectFileForPublishTask(uiContext);
        readBundleMetaData(report, metaData, selectFileForPublishTask);

        final String selectedReport = selectFileForPublishTask.selectFile(loginData, oldName);
        if (selectedReport == null) {
            return;
        }

        loginData.setOption("lastFilename", selectedReport);
        storeBundleMetaData(report, selectedReport, selectFileForPublishTask);

        reportDesignerContext.getActiveContext().getAuthenticationStore().add(loginData, storeUpdates);

        final byte[] data = PublishUtil.createBundleData(report);
        int responseCode = PublishUtil.publish(data, selectedReport, loginData);

        if (responseCode == 200) {
            final Component glassPane = SwingUtilities.getRootPane(uiContext).getGlassPane();
            try {
                glassPane.setVisible(true);
                glassPane.setCursor(new Cursor(Cursor.WAIT_CURSOR));

                FileObject fileSystemRoot = PublishUtil.createVFSConnection(loginData);
                final JCRSolutionFileSystem fileSystem = (JCRSolutionFileSystem) fileSystemRoot.getFileSystem();
                fileSystem.getLocalFileModel().refresh();
            } catch (Exception e1) {
                UncaughtExceptionsModel.getInstance().addException(e1);
            } finally {
                glassPane.setVisible(false);
                glassPane.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
            }
            if (JOptionPane.showConfirmDialog(uiContext,
                    Messages.getInstance().getString("PublishToServerAction.Successful.LaunchNow"),
                    Messages.getInstance().getString("PublishToServerAction.Successful.LaunchTitle"),
                    JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                PublishUtil.launchReportOnServer(loginData.getUrl(), selectedReport);
            }
        } else if (responseCode == 403) {
            logger.error("Publish failed. Server responded with status-code " + responseCode);
            JOptionPane.showMessageDialog(uiContext,
                    Messages.getInstance().getString("PublishToServerAction.FailedAccess"),
                    Messages.getInstance().getString("PublishToServerAction.FailedAccessTitle"),
                    JOptionPane.ERROR_MESSAGE);
        } else {
            logger.error("Publish failed. Server responded with status-code " + responseCode);
            showErrorMessage();
        }
    } catch (Exception exception) {
        logger.error("Publish failed. Unexpected error:", exception);
        showErrorMessage();
    }
}

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

/**
 * Displays a message dialog//from  w w  w.ja va2s. c  o m
 * @param aParent
 * @param aMsg
 * @param aTitle
 * @param aType
 */
public static void showDialog(Frame aParent, String aMsg, String aTitle, int aType) {
    aParent.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    JOptionPane.showMessageDialog(aParent, aMsg, aTitle, aType);
}

From source file:StocksTable5.java

public void retrieveData() {
    SimpleDateFormat frm = new SimpleDateFormat("MM/dd/yyyy");
    String currentDate = frm.format(m_data.m_date);
    String result = (String) JOptionPane.showInputDialog(this, "Please enter date in form mm/dd/yyyy:", "Input",
            JOptionPane.INFORMATION_MESSAGE, null, null, currentDate);
    if (result == null)
        return;/*from w  w w. j  a va 2  s .  c o m*/

    java.util.Date date = null;
    try {
        date = frm.parse(result);
    } catch (java.text.ParseException ex) {
        date = null;
    }

    if (date == null) {
        JOptionPane.showMessageDialog(this, result + " is not a valid date", "Warning",
                JOptionPane.WARNING_MESSAGE);
        return;
    }

    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    switch (m_data.retrieveData(date)) {
    case 0: // Ok with data
        m_title.setText(m_data.getTitle());
        m_table.tableChanged(new TableModelEvent(m_data));
        m_table.repaint();
        break;
    case 1: // No data
        JOptionPane.showMessageDialog(this, "No data found for " + result, "Warning",
                JOptionPane.WARNING_MESSAGE);
        break;
    case -1: // Error
        JOptionPane.showMessageDialog(this, "Error retrieving data", "Warning", JOptionPane.WARNING_MESSAGE);
        break;
    }
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:org.jets3t.gui.JHtmlLabel.java

/**
 * Changes the mouse cursor to a hand to indicate when the mouse moves over a clickable
 * HTML link.//from  w  ww.  j ava2 s  .  com
 *
 * @param e event
 */
public void mouseMoved(MouseEvent e) {
    AccessibleJLabel acc = (AccessibleJLabel) getAccessibleContext();
    int stringIndexAtPoint = acc.getIndexAtPoint(e.getPoint());
    if (stringIndexAtPoint < 0) {
        return;
    }
    javax.swing.text.AttributeSet attr = acc.getCharacterAttribute(stringIndexAtPoint);
    if (attr.getAttribute(HTML.Tag.A) == null) {
        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    } else {
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    }
}

From source file:edu.ku.brc.specify.tasks.subpane.wb.SGRResultsForForm.java

public void refresh() {
    if (currentIndex < 0)
        return;/*  ww w .  ja va  2  s. c  om*/

    removeAll();
    repaint();

    if (!sgrPlugin.isReady()) {
        showMessage("SGR_NO_MATCHER");
        return;
    }

    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    new SwingWorker<MatchResults, Void>() {
        private int index = currentIndex;

        @Override
        protected MatchResults doInBackground() throws Exception {
            int modelIndex = workbenchPaneSS.getSpreadSheet().convertRowIndexToModel(index);
            WorkbenchRow row = workbench.getRow(modelIndex);
            return isEmpty(row) ? null : sgrPlugin.doQuery(row);
        }

        @Override
        protected void done() {
            // if we changed indexes in the meantime, don't show this result.
            if (index != currentIndex)
                return;
            //removeAll();

            try {
                results = get();
            } catch (CancellationException e) {
                return;
            } catch (InterruptedException e) {
                return;
            } catch (ExecutionException e) {
                sgrFailed(e);
                setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                return;
            }

            setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
            if (results == null || results.matches.size() < 1) {
                showMessage("SGR_NO_RESULTS");
                return;
            }

            float maxScore = sgrPlugin.getColorizer().getMaxScore();
            if (maxScore == 0.0f)
                maxScore = 22.0f;

            StringBuilder columns = new StringBuilder("right:max(50dlu;p)");
            for (Match result : results) {
                columns.append(", 4dlu, 150dlu:grow");
            }

            String[] fields = columnOrdering.getFields();
            StringBuilder rows = new StringBuilder();
            for (int i = 0; i < fields.length - 1; i++) {
                rows.append("p, 4dlu,");
            }
            rows.append("p");

            FormLayout layout = new FormLayout(columns.toString(), rows.toString());
            PanelBuilder builder = new PanelBuilder(layout, SGRResultsForForm.this);
            CellConstraints cc = new CellConstraints();

            int y = 1;
            for (String heading : columnOrdering.getHeadings()) {
                builder.addLabel(heading + ":", cc.xy(1, y));
                y += 2;
            }

            int x = 3;
            for (Match result : results) {
                y = 1;
                for (String field : fields) {
                    String value;
                    Color color;
                    if (field.equals("id")) {
                        value = result.match.id;
                        color = SGRColors.colorForScore(result.score, maxScore);
                    } else if (field.equals("score")) {
                        value = String.format("%1$.2f", result.score);
                        color = SGRColors.colorForScore(result.score, maxScore);
                    } else {
                        value = StringUtils.join(result.match.getFieldValues(field).toArray(), "; ");
                        Float fieldContribution = result.fieldScoreContributions().get(field);
                        color = SGRColors.colorForScore(result.score, maxScore, fieldContribution);
                    }

                    JTextField textField = new JTextField(value);
                    textField.setBackground(color);
                    textField.setEditable(false);
                    textField.setCaretPosition(0);
                    builder.add(textField, cc.xy(x, y));
                    y += 2;
                }
                x += 2;
            }
            getParent().validate();
        }
    }.execute();
    UsageTracker.incrUsageCount("SGR.MatchRow");
}

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

public void mouseExited(MouseEvent e) {
    IsMovable = false;
    initialMovePointY = 0;
    chartPanel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}

From source file:com.globalsight.everest.webapp.applet.admin.customer.FileSystemApplet.java

/**
 * Prepare the info for the upload process and zip all the files.
 *//*from   w ww .  j  av a  2s  . c o  m*/
private void performUploadProcess(String servletLocation, String targetLocation, String randID,
        Vector p_outgoingData) {
    try {
        m_progressBar.setValue(10);
        getParentFrame().setCursor(Cursor.WAIT_CURSOR);
        String lineRead = null;
        String result = null;

        Vector outgoingData = new Vector();
        outgoingData.addElement(p_outgoingData);
        outgoingData.addElement(randID);

        Object[] objs = (Object[]) p_outgoingData.get(0);
        int size = objs == null ? 0 : objs.length;
        File[] files = new File[size];
        System.arraycopy(objs, 0, files, 0, size);
        m_progressBar.setValue(20);
        sendZipFile(files, servletLocation, targetLocation);
    } catch (Exception ioe) //IOException, ClassNotFoundException
    {
        System.err.println(ioe);
        AppletHelper.getErrorDlg(ioe.getMessage(), null);
    } finally {
        getParentFrame().setCursor(Cursor.DEFAULT_CURSOR);
    }
}