Example usage for java.awt Cursor HAND_CURSOR

List of usage examples for java.awt Cursor HAND_CURSOR

Introduction

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

Prototype

int HAND_CURSOR

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

Click Source Link

Document

The hand cursor type.

Usage

From source file:Main.java

private void ShowDialog() {
    JLabel label = new JLabel("Move mouse here for hand cursor");
    label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    JOptionPane pane = new JOptionPane(label);
    pane.setOptions(new Object[] { "OK" });

    JDialog dialog = pane.createDialog(this, "Test Dialog");
    dialog.setVisible(true);//ww w .  ja va 2s .co  m
}

From source file:Main.java

public JHyperlinkLabel(String label) {
    super(label);

    setForeground(Color.BLUE.darker());
    setCursor(new Cursor(Cursor.HAND_CURSOR));
    addMouseListener(new HyperlinkLabelMouseAdapter());
}

From source file:Main.java

public Main() {
    this.setSize(300, 100);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    website.setText("<html> Website:<a href=''>http://www.java2s.com/</a></html>");
    website.setCursor(new Cursor(Cursor.HAND_CURSOR));
    pan.add(website);//from  w  w w .j a  v  a  2 s .c o m
    this.setContentPane(pan);
    this.setVisible(true);
    goWebsite(website);
}

From source file:URLLabel.java

public void mouseEntered(MouseEvent e) {
    setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    entered = true;//from   ww  w  .  j av a2s. co  m

    if (mousehover) {
        repaint();
    }
}

From source file:edu.uci.ics.jung.visualization.control.LabelEditingGraphMousePlugin.java

/**
 * create an instance with overides/*w  w  w  .ja v a2 s  . c  o m*/
 * @param selectionModifiers for primary selection
 * @param addToSelectionModifiers for additional selection
 */
public LabelEditingGraphMousePlugin(int selectionModifiers) {
    super(selectionModifiers);
    this.cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
}

From source file:com.igormaznitsa.zxpoly.ui.AboutDialog.java

public AboutDialog(final java.awt.Frame parent) {
    super(parent, true);
    initComponents();// w ww  .  jav a2  s .c o m

    this.editorPane.addHyperlinkListener(new HyperlinkListener() {

        @Override
        public void hyperlinkUpdate(final HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                try {
                    Desktop.getDesktop().browse(e.getURL().toURI());
                } catch (Exception ex) {
                }
            } else if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) {
                editorPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            } else if (e.getEventType() == HyperlinkEvent.EventType.EXITED) {
                editorPane.setCursor(Cursor.getDefaultCursor());
            }
        }
    });

    this.editorPane.setContentType("text/html");
    try {
        final String htmlText = IOUtils.toString(openAboutResource("index.html"), "UTF-8");
        this.editorPane.setText(htmlText);
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    setLocationRelativeTo(parent);
}

From source file:com.mirth.connect.client.ui.components.MirthIconTextField.java

public MirthIconTextField(ImageIcon icon) {
    setIcon(icon);/*from   w w  w.j  a v  a2s . c  o  m*/

    addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent evt) {
            if (isIconActive(evt) && iconPopupMenuComponent != null) {
                JPopupMenu iconPopupMenu = new JPopupMenu();
                iconPopupMenu.insert(iconPopupMenuComponent, 0);
                iconPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
            }
        }
    });

    addMouseMotionListener(new MouseMotionAdapter() {
        @Override
        public void mouseMoved(MouseEvent evt) {
            int cursorType = getCursor().getType();

            if (isIconActive(evt)) {
                if (StringUtils.isNotBlank(alternateToolTipText)) {
                    MirthIconTextField.super.setToolTipText(alternateToolTipText);
                }

                if (iconPopupMenuComponent != null) {
                    if (cursorType != Cursor.HAND_CURSOR) {
                        setCursor(new Cursor(Cursor.HAND_CURSOR));
                    }
                } else {
                    if (cursorType != Cursor.DEFAULT_CURSOR) {
                        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                    }
                }
            } else {
                if (StringUtils.isNotBlank(alternateToolTipText)) {
                    MirthIconTextField.super.setToolTipText(originalToolTipText);
                }

                if (cursorType != Cursor.TEXT_CURSOR) {
                    setCursor(new Cursor(Cursor.TEXT_CURSOR));
                }
            }
        }
    });
}

From source file:aurelienribon.gdxsetupui.ui.panels.ConfigUpdatePanel.java

public ConfigUpdatePanel(final MainPanel mainPanel) {
    initComponents();/*from   w  w w.  j  a v  a  2 s . c om*/

    browseBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            browse();
        }
    });

    advancedSettingsLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    advancedSettingsLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            if (clicToShowSettings && mainPanel.showAdvancedSettings()) {
                clicToShowSettings = false;
                advancedSettingsLabel.setText("< Hide advanced settings");
            } else if (mainPanel.hideAdvancedSettings()) {
                clicToShowSettings = true;
                advancedSettingsLabel.setText("Show advanced settings >");
            }
        }
    });

    Style.registerCssClasses(headerPanel, ".header");
    Style.registerCssClasses(numberLabel, ".headerNumber");
    Style.registerCssClasses(advancedSettingsLabel, ".linkLabel");
    Style.registerCssClasses(statusCoreLabel, ".statusLabel");
    Style.registerCssClasses(statusAndroidLabel, ".statusLabel");
    Style.registerCssClasses(statusDesktopLabel, ".statusLabel");
    Style.registerCssClasses(statusHtmlLabel, ".statusLabel");
    Style.registerCssClasses(browseBtn, ".center");

    Ctx.listeners.add(new Ctx.Listener() {
        @Override
        public void cfgUpdateChanged() {
            updateClasspaths();
        }
    });
}

From source file:com.mirth.connect.client.ui.LoginPanel.java

private LoginPanel() {
    initComponents();/*from   w w  w .  ja va  2  s.  c  o  m*/
    jLabel2.setForeground(UIConstants.HEADER_TITLE_TEXT_COLOR);
    jLabel5.setForeground(UIConstants.HEADER_TITLE_TEXT_COLOR);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setIconImage(new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/mirth_32_ico.png"))
            .getImage());

    mirthCorpImage.setIcon(UIConstants.MIRTHCORP_LOGO);
    mirthCorpImage.setText("");
    mirthCorpImage.setToolTipText(UIConstants.MIRTHCORP_TOOLTIP);
    mirthCorpImage.setCursor(new Cursor(Cursor.HAND_CURSOR));

    mirthCorpImage.addMouseListener(new java.awt.event.MouseAdapter() {

        public void mouseClicked(java.awt.event.MouseEvent evt) {
            BareBonesBrowserLaunch.openURL(UIConstants.MIRTHCORP_URL);
        }
    });

    mirthCorpImage1.setIcon(UIConstants.MIRTHCORP_LOGO);
    mirthCorpImage1.setText("");
    mirthCorpImage1.setToolTipText(UIConstants.MIRTHCORP_TOOLTIP);
    mirthCorpImage1.setCursor(new Cursor(Cursor.HAND_CURSOR));

    mirthCorpImage1.addMouseListener(new java.awt.event.MouseAdapter() {

        public void mouseClicked(java.awt.event.MouseEvent evt) {
            BareBonesBrowserLaunch.openURL(UIConstants.MIRTHCORP_URL);
        }
    });

    placeholderButton.setVisible(false);

    errorTextArea.setBackground(Color.WHITE);
    errorTextArea.setDisabledTextColor(Color.RED);
}

From source file:org.jcurl.demo.editor.LocationController.java

/**
 * /*from  ww w.  j  a va  2s.c om*/
 * @param model
 *            final. Sets the <code>panel</code>'s model.
 * @param panel
 *            required for wc <->dc conversion. Repaint is triggered via
 *            {@link org.jcurl.core.base.RockSet#notifyChange()}.
 */
public LocationController(final PositionSet model, final PositionDisplay panel) {
    panel.addMouseMotionListener(this);
    panel.setPos(model);

    this.panel = panel;
    locations = model;
    // this.model.addPropertyChangeListener(this);
    CursorDefault = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
    CursorIn = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
}