Example usage for java.awt Cursor Cursor

List of usage examples for java.awt Cursor Cursor

Introduction

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

Prototype

protected Cursor(String name) 

Source Link

Document

Creates a new custom cursor object with the specified name.

Note: this constructor should only be used by AWT implementations as part of their support for custom cursors.

Usage

From source file:net.sf.maltcms.chromaui.chromatogram1Dviewer.ui.panel.Chromatogram1DHeatmapViewerPanel.java

/**
 * Creates new form Chromatogram2DViewerPanel
 */// w  w  w .  ja va  2  s .  co  m
public Chromatogram1DHeatmapViewerPanel(InstanceContent topComponentInstanceContent, Lookup tcLookup,
        ADataset2D<IChromatogram1D, IScan> ds) {
    initComponents();
    this.content = topComponentInstanceContent;
    this.lookup = tcLookup;
    chart = new JFreeChart(new XYPlot());
    chartPanel = new ContextAwareChartPanel(chart, true, true, true, true, true);
    Cursor crosshairCursor = new Cursor(Cursor.CROSSHAIR_CURSOR);
    chartPanel.setCursor(crosshairCursor);
    //        chart.addProgressListener(cdxpanel);
    chartPanel.setInitialDelay(100);
    chartPanel.setDismissDelay(30000);
    chartPanel.setReshowDelay(0);
    chartPanel.setFocusable(true);
    jPanel2.add(chartPanel, BorderLayout.CENTER);
    content.add(chartPanel);
    addKeyListener(this);
    dataRange = DatasetUtilities.findDomainBounds(ds);
}

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

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

From source file:com.tascape.qa.th.android.tools.UiAutomatorViewer.java

private void launchApp() {
    try {/*from www.j a  v a 2 s  . c o  m*/
        jd.setCursor(new Cursor(Cursor.WAIT_CURSOR));
        String serial = ((String) this.jcbDevices.getSelectedItem());
        Adb adb = new Adb(serial.split(":")[0]);
        device = new UiAutomatorDevice();
        device.setAdb(adb);
        device.setProductDetail(serial);
        device.start();
        this.setDevice(device);
        this.launch();
    } catch (Throwable ex) {
        LOG.error("Error", ex);
        JOptionPane.showMessageDialog(jbLaunch.getTopLevelAncestor(), "Cannot start app");
        return;
    } finally {
        jd.setCursor(Cursor.getDefaultCursor());
    }

    int debugMinutes = (int) jsDebugMinutes.getValue();
    jd.dispose();
    try {
        this.interactManually(debugMinutes);
    } catch (Throwable ex) {
        LOG.error("Error", ex);
        System.exit(1);
    } finally {
        System.exit(0);
    }
}

From source file:fxts.stations.ui.help.HelpPane.java

/**
 * Inits all components.//ww w.  ja  v a2 s. co  m
 */
private void initComponents() {
    //creates history
    mHistory = new HelpContentHistory();
    //Create the text area for contents
    mTabbedPane = new JTabbedPane();

    //creates content tree
    mContentTree = new ContentTree("fxts/stations/trader/resources/help/contents.xml");
    mContentTree.addListener(this);

    //Create the scroll pane and add the tree to it.
    JScrollPane treeView = new JScrollPane(mContentTree.getTree());
    mTabbedPane.addTab(mResMan.getString("IDS_HELP_CONTENTS", "Contents"), treeView);

    //xxx workaround for bug #6424509, memory leak
    JEditorPane.registerEditorKitForContentType("text/html", WeakHTMLEditorKit.class.getName());
    //creates the text area for the showing of the help.
    mHtmlPage = new JEditorPane();
    mHtmlPage.setEditable(false);
    mHtmlPage.putClientProperty("charset", "UTF-16");
    mHtmlPage.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent aEvent) {
            if (aEvent.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                try {
                    onSelectContentByHyperlink(aEvent.getURL());
                    mHtmlPage.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                } catch (Exception e) {
                    mLogger.error("Hiperlink not processed!");
                    e.printStackTrace();
                }
            }
        }
    });
    JScrollPane scrollPane = new JScrollPane(mHtmlPage);

    //creates a split pane for the change log and the text area.
    mSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mTabbedPane, scrollPane);
    mSplitPane.setOneTouchExpandable(true);

    //Creates the toolbar area.
    JToolBar toolbar = UIManager.getInst().createToolBar();
    toolbar.setFloatable(false);

    //creates label with left arrow
    UIManager uiMan = UIManager.getInst();
    mBackButton = uiMan.createButton(null, "ID_HELP_LEFT_ARROW", "ID_HELP_LEFT_ARROW_DESC",
            "ID_HELP_LEFT_ARROW_DESC");
    mBackButton.setEnabled(false);
    mBackButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent aEvent) {
            if (mHistory.hasBackStep()) {
                mIsHistorycalStep = true;
                onSelectContent(mHistory.back());
                mBackButton.setEnabled(mHistory.hasBackStep());
                mForwardButton.setEnabled(mHistory.hasForwardStep());
            }
        }
    });
    toolbar.add(mBackButton);

    //creates label with right arrow
    mForwardButton = uiMan.createButton(null, "ID_HELP_RIGHT_ARROW", "ID_HELP_RIGHT_ARROW_DESC",
            "ID_HELP_RIGHT_ARROW_DESC");
    mForwardButton.setEnabled(false);
    mForwardButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent aEvent) {
            if (mHistory.hasForwardStep()) {
                mIsHistorycalStep = true;
                onSelectContent(mHistory.forward());
                mBackButton.setEnabled(mHistory.hasBackStep());
                mForwardButton.setEnabled(mHistory.hasForwardStep());
            }
        }
    });
    toolbar.add(mForwardButton);

    //creates label with up arrow
    mUpButton = uiMan.createButton(null, "ID_HELP_UP_ARROW", "ID_HELP_UP_ARROW_DESC", "ID_HELP_UP_ARROW_DESC");
    mUpButton.setEnabled(mContentTree.getIterator().hasPrevious());
    mUpButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent aEvent) {
            mContentsBrowsing = true;
            onSelectContent(mContentTree.getIterator().previous());
            mUpButton.setEnabled(mContentTree.getIterator().hasPrevious());
            mDownButton.setEnabled(mContentTree.getIterator().hasNext());
        }
    });
    toolbar.add(mUpButton);

    //creates label with down arrow
    mDownButton = uiMan.createButton(null, "ID_HELP_DOWN_ARROW", "ID_HELP_DOWN_ARROW_DESC",
            "ID_HELP_DOWN_ARROW_DESC");
    mDownButton.setEnabled(mContentTree.getIterator().hasNext());
    mDownButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent aEvent) {
            mContentsBrowsing = true;
            onSelectContent(mContentTree.getIterator().next());
            mUpButton.setEnabled(mContentTree.getIterator().hasPrevious());
            mDownButton.setEnabled(mContentTree.getIterator().hasNext());
        }
    });
    toolbar.add(mDownButton);

    //sets layout
    setLayout(new BorderLayout());

    //add the components to the frame.
    add(mSplitPane, BorderLayout.CENTER);
    add(toolbar, BorderLayout.NORTH);

    //sets first page
    onSelectContent(mContentTree.getIterator().toBegin());
}

From source file:osu.beatmapdownloader.JFrame.java

public void dificultHelp() {
       String text = "More Info";
       L_difHelp.setText("<html><a href=\"\">" + text + "</a></html>");
       L_difHelp.setCursor(new Cursor(Cursor.HAND_CURSOR));
       L_difHelp.addMouseListener(new MouseAdapter() {
           @Override//from   w  w w .  ja v  a  2 s .  c o m
           public void mouseClicked(MouseEvent e) {
               try {
                   Desktop.getDesktop().browse(new URI("https://osu.ppy.sh/forum/t/178700&start=0"));
               } catch (URISyntaxException | IOException ex) {
               }
           }
       });
   }

From source file:org.gitools.ui.core.components.boxes.DetailsBox.java

private Component createNameLabel(DetailsDecoration detail) {

    if (detail instanceof JComponentDetailsDecoration) {
        Component c = createComponentNameLabel((JComponentDetailsDecoration) detail);
        if (c != null) {
            return c;
        }/*  ww  w .ja va 2s .c  o  m*/
    }

    WebLabel label = new WebLabel(StringUtils.capitalize(detail.getName()), JLabel.TRAILING);

    label.setDrawShade(true);
    SwingUtils.changeFontSize(label, -1);

    if (detail.isSelected()) {
        SwingUtils.setBoldFont(label);
    }

    label.setCursor(new Cursor(Cursor.HAND_CURSOR));
    label.addMouseListener(new PropertyMouseListener(detail));

    if (StringUtils.isNotEmpty(detail.getDescription())) {
        String description = "<html><body width=\"300px\">" + detail.getDescription() + "</body></html>";
        TooltipManager.setTooltip(label, description, TooltipWay.down, 0);
    }

    if (!StringUtils.isEmpty(detail.getDescriptionLink())) {
        DetailsWebLinkLabel webLabel = new DetailsWebLinkLabel("", JLabel.TRAILING);
        webLabel.setIcon(IconNames.INFO_ICON);
        webLabel.setLink(detail.getDescriptionLink(), false);
        TooltipManager.setTooltip(webLabel, detail.getDescriptionLink(), TooltipWay.down, 0);
        return new GroupPanel(GroupingType.fillFirst, 5, webLabel, label);
    }

    return label;
}

From source file:com.ssn.listener.SSNFacebookAlbumSelectionListener.java

private void createComponents(SSNHomeForm ssnHomeForm, List<Photo> completePhotoList, SSNAlbumNode albumNode) {
    SSNHelper.toggleDeleteAndShareImages(false, ssnHomeForm);

    try {/* w  w w . j a  va2s.co m*/
        List<File> listOfFiles = new ArrayList<File>();

        File facebookPhotosDir = new File(
                SSNHelper.getFacebookPhotosDirPath() + albumNode.getAlbum().getName() + File.separator);
        if (!facebookPhotosDir.exists()) {
            facebookPhotosDir.mkdir();
        }

        for (Photo photo : completePhotoList) {
            String imageUrl = "";
            for (Image image : photo.getImages()) {
                if (image != null && image.getHeight() <= 500) {
                    imageUrl = image.getSource();
                    break;
                }
            }

            if (imageUrl.isEmpty()) {
                imageUrl = photo.getSource();
            }
            URL url = new URL(imageUrl);
            File file = new File(facebookPhotosDir.getAbsolutePath() + File.separator + photo.getId() + ".jpg");
            if (!file.exists()) {
                try {
                    FileUtils.copyURLToFile(url, file);
                    listOfFiles.add(file);
                } catch (Exception e) {
                    logger.error(e);
                }
            } else {
                listOfFiles.add(file);
            }
        }

        File[] fileArray = listOfFiles.toArray(new File[0]);
        SSNGalleryHelper contentPane = new SSNGalleryHelper(fileArray, ssnHomeForm);
        contentPane.setBackground(SSNConstants.SSN_BLACK_BACKGROUND_COLOR);

        ssnHomeForm.getSsnHomeCenterPanel().removeAll();
        ssnHomeForm.getSsnHomeCenterMainPanel().removeAll();

        ssnHomeForm.getSsnHomeCenterPanel().add(ssnHomeForm.getScrollPane(contentPane,
                SSNHelper.getAlbumNameFromPath(ssnHomeForm.ssnFileExplorer.m_display.getText())));
        ssnHomeForm
                .getSsnHomeCenterMainPanel().add(
                        ssnHomeForm.getSortPanel("Date", false,
                                SSNHelper
                                        .getAlbumNameFromPath(ssnHomeForm.ssnFileExplorer.m_display.getText())),
                        BorderLayout.NORTH);
        ssnHomeForm.getSsnHomeCenterMainPanel().add(ssnHomeForm.getSsnHomeCenterPanel(), BorderLayout.CENTER);
        ssnHomeForm.getHomeModel().getSSNMediaFolderProperties(
                ssnHomeForm.getHomeModel().getHomeForm().ssnFileExplorer.m_display.getText(), fileArray);
        // ssnHomeForm.add(ssnHomeForm.getSsnHomeCenterMainPanel());

        //             ssnHomeForm.getSplitPane().setLeftComponent(ssnHomeForm.getSsnHomeLeftMainPanel());
        //             ssnHomeForm.getSplitPane().setRightComponent(ssnHomeForm.getSsnHomeCenterMainPanel());
        //                //ssnHomeForm.getSplitPane().setDividerLocation(200);
        //             ssnHomeForm.getSplitPane().revalidate();
        //             ssnHomeForm.getSplitPane().repaint();

        ssnHomeForm.revalidate();
        ssnHomeForm.repaint();
        ssnHomeForm.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.projity.pm.graphic.graph.GraphInteractor.java

protected Cursor getProgressCursor() {
    if (progressCursor == null) {
        try {/* www.  ja  v  a 2  s  . co m*/
            progressCursor = Toolkit.getDefaultToolkit().createCustomCursor(
                    IconManager.getImage("gantt.progress.cursor"), new Point(15, 5), "ProgressCursor");
        } catch (Exception e) {
            progressCursor = new Cursor(Cursor.HAND_CURSOR);
        }
    }
    return progressCursor;
}

From source file:com.projity.pm.graphic.graph.GraphInteractor.java

protected Cursor getLinkCursor() {
    if (linkCursor == null) {
        try {// w w  w. j a  v  a  2 s  . c  o  m
            linkCursor = Toolkit.getDefaultToolkit().createCustomCursor(
                    IconManager.getImage("gantt.link.cursor"), new Point(7, 3), "linkCursor");
        } catch (Exception e) {
            linkCursor = new Cursor(Cursor.HAND_CURSOR);
        }
    }
    return linkCursor;
}

From source file:view.ImagePanel.java

public void refreshSignatureValidationListPanels() {
    for (JPanel jp : panelList) {
        remove(jp);/*from   w w  w .j a  va  2s .co m*/
    }

    if (buf == null) {
        return;
    }

    if (pdfDocument != null) {
        if (svList != null) {
            Point p = getImageLocation();
            for (final SignatureValidation sv : svList) {
                try {
                    int pgNumber = sv.getPosList().get(0).page - 1;
                    if (this.pageNumber == pgNumber) {
                        for (AcroFields.FieldPosition pos : sv.getPosList()) {
                            int p1 = (int) (p.x + (pos.position.getLeft() * scale));
                            int p2 = (int) (p.y
                                    + Math.floor((pdfDocument.getPage(pageNumber).getCropBox().getHeight()
                                            - pos.position.getTop()) * scale));
                            int p3 = (int) (pos.position.getWidth() * scale);
                            int p4 = (int) (pos.position.getHeight() * scale);

                            final JPanel jp1 = sv.getPanel();
                            jp1.setLocation(p1, p2);
                            jp1.setSize(p3, p4);

                            if (sv.equals(selectedSignature)) {
                                jp1.setBackground(new Color(0, 0, 0, 45));
                                jp1.setBorder(new LineBorder(Color.BLACK, 1));
                            } else {
                                jp1.setBackground(new Color(0, 0, 0, 0));
                                jp1.setBorder(null);
                            }

                            jp1.setVisible(true);
                            jp1.addMouseListener(new MouseAdapter() {
                                @Override
                                public void mouseEntered(java.awt.event.MouseEvent evt) {
                                    if (mainWindow.getWorkspacePanel()
                                            .getStatus() != WorkspacePanel.Status.SIGNING) {
                                        jp1.setCursor(new Cursor(Cursor.HAND_CURSOR));
                                        jp1.setBackground(new Color(0, 0, 0, 45));
                                        jp1.setBorder(new LineBorder(Color.BLACK, 1));
                                        repaint();
                                    } else {
                                        jp1.setCursor(null);
                                    }
                                }

                                @Override
                                public void mouseExited(java.awt.event.MouseEvent evt) {
                                    if (mainWindow.getWorkspacePanel()
                                            .getStatus() != WorkspacePanel.Status.SIGNING) {
                                        if (selectedSignature == null) {
                                            jp1.setBackground(new Color(0, 0, 0, 0));
                                            jp1.setBorder(null);
                                            repaint();
                                        } else if (!selectedSignature.equals(sv)) {
                                            jp1.setBackground(new Color(0, 0, 0, 0));
                                            jp1.setBorder(null);
                                            repaint();
                                        }
                                    }
                                }
                            });
                            panelList.add(jp1);
                            add(jp1);
                            repaint();
                        }
                    }
                } catch (Exception e) {
                }
            }
        }
    }
}