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:Simulator.java

private void AddMouseListeners() {
    map().addMouseListener(new MouseAdapter() {
        @Override/*from www.j a  va 2  s .co  m*/
        public void mouseClicked(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON1) {
                map().getAttribution().handleAttribution(e.getPoint(), true);
            }
        }
    });

    map().addMouseMotionListener(new MouseAdapter() {
        @Override
        public void mouseMoved(MouseEvent e) {
            Point p = e.getPoint();
            boolean cursorHand = map().getAttribution().handleAttributionCursor(p);
            if (cursorHand) {
                map().setCursor(new Cursor(Cursor.HAND_CURSOR));
            } else {
                map().setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
            }
        }
    });
}

From source file:Main.java

protected void setState(boolean active) {
    isActive = active;//  w  ww.j  a  v  a 2s.  co m
    repaint();
    if (active) {
        if (button != null)
            button.setState(false);
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else {
        button = null;
        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }
}

From source file:utybo.branchingstorytree.swing.visuals.AboutDialog.java

@SuppressWarnings("unchecked")
public AboutDialog(OpenBSTGUI parent) {
    super(parent);
    setTitle(Lang.get("about.title"));
    setModalityType(ModalityType.APPLICATION_MODAL);

    JPanel banner = new JPanel(new FlowLayout(FlowLayout.CENTER));
    banner.setBackground(OpenBSTGUI.OPENBST_BLUE);
    JLabel lblOpenbst = new JLabel(new ImageIcon(Icons.getImage("FullLogoWhite", 48)));
    lblOpenbst.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    banner.add(lblOpenbst, "flowx,cell 0 0,alignx center");
    getContentPane().add(banner, BorderLayout.NORTH);

    JPanel pan = new JPanel();
    pan.setLayout(new MigLayout("insets 10, gap 10px", "[grow]", "[][][grow]"));
    getContentPane().add(pan, BorderLayout.CENTER);

    JLabel lblWebsite = new JLabel("https://utybo.github.io/BST/");
    Font f = lblWebsite.getFont();
    @SuppressWarnings("rawtypes")
    Map attrs = f.getAttributes();
    attrs.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
    lblWebsite.setFont(f.deriveFont(attrs));
    lblWebsite.setForeground(OpenBSTGUI.OPENBST_BLUE);
    lblWebsite.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    lblWebsite.addMouseListener(new MouseAdapter() {
        @Override// w  w  w . j av a2 s. c om
        public void mouseClicked(MouseEvent e) {
            if (Desktop.isDesktopSupported()) {
                try {
                    Desktop.getDesktop().browse(new URL("https://utybo.github.io/BST/").toURI());
                } catch (IOException | URISyntaxException e1) {
                    OpenBST.LOG.warn("Exception when trying to open website", e1);
                }
            }
        }
    });
    pan.add(lblWebsite, "cell 0 0,alignx center");

    JLabel lblVersion = new JLabel(Lang.get("about.version").replace("$v", OpenBST.VERSION));
    pan.add(lblVersion, "flowy,cell 0 1");

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBorder(new LineBorder(pan.getBackground().darker(), 1, false));
    pan.add(scrollPane, "cell 0 2,grow");

    JTextArea textArea = new JTextArea();
    textArea.setMargin(new Insets(5, 5, 5, 5));
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);
    textArea.setFont(new Font(textArea.getFont().getFontName(), Font.PLAIN, (int) (Icons.getScale() * 11)));

    try (InputStream in = getClass().getResourceAsStream("/utybo/branchingstorytree/swing/about.txt");) {
        textArea.setText(IOUtils.toString(in, StandardCharsets.UTF_8));
    } catch (IOException ex) {
        OpenBST.LOG.warn("Loading about information failed", ex);
    }
    textArea.setEditable(false);
    textArea.setCaretPosition(0);
    scrollPane.setViewportView(textArea);

    JLabel lblTranslatedBy = new JLabel(Lang.get("author"));
    pan.add(lblTranslatedBy, "cell 0 1");

    setSize((int) (Icons.getScale() * 450), (int) (Icons.getScale() * 400));
    setLocationRelativeTo(parent);
}

From source file:com.antelink.sourcesquare.gui.view.CopyrightPanel.java

private JLabel createJLabelWithHyperlink(String text, final String href) {
    JLabel label = new JLabel("<html><a href=\"\">" + text + "<a/></html>");
    label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    label.addMouseListener(new MouseListener() {

        @Override/*ww  w.  ja  v a2s.  c o m*/
        public void mouseReleased(MouseEvent arg0) {
        }

        @Override
        public void mousePressed(MouseEvent arg0) {
        }

        @Override
        public void mouseExited(MouseEvent arg0) {
        }

        @Override
        public void mouseEntered(MouseEvent arg0) {
        }

        @Override
        public void mouseClicked(MouseEvent arg0) {
            try {
                Desktop.getDesktop().browse(new URI(href));
            } catch (IOException e) {
                logger.error("Error opening the browser", e);
            } catch (URISyntaxException e) {
                logger.error("Error opening the browser", e);
            }
        }
    });
    return label;
}

From source file:com.willwinder.ugs.nbp.core.services.SettingsChangedNotificationService.java

private JComponent createRestartNotificationDetails() {
    JPanel panel = new JPanel(new BorderLayout(10, 10));
    panel.setOpaque(false);/*from   w  w  w  . j  a  va  2  s .c om*/

    JLabel label = new JLabel(Localization.getString("platform.window.restart.changed.settings")); //NOI18N
    label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    panel.add(label, BorderLayout.CENTER);

    label.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (null != restartNotification) {
                restartNotification.clear();
                restartNotification = null;
            }

            LifecycleManager.getDefault().markForRestart();
            LifecycleManager.getDefault().exit();
        }
    });
    return panel;
}

From source file:io.github.jeddict.db.modeler.widget.TableWidget.java

public TableWidget(DBModelerScene scene, NodeWidgetInfo node) {
    super(scene, node);
    this.setName(((DBTable) node.getBaseElementSpec()).getName());
    this.setImage(this.getNodeWidgetInfo().getModelerDocument().getImage());
    this.getImageWidget().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    this.getImageWidget().getActions().addAction(new TableAction());
    getNodeNameWidget().getActions().removeAction(editAction);
}

From source file:de.mendelson.comm.as2.client.HTMLPanel.java

/**Listen to be a HyperlinkListener*/
@Override/* w  w  w  .  j a  v a  2  s. co  m*/
public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        try {
            URI uri = new URI(e.getURL().toExternalForm());
            Desktop.getDesktop().browse(uri);
        } catch (Exception ex) {
            //nop
        }
    }
    if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) {
        jEditorPane.setCursor(new Cursor(Cursor.HAND_CURSOR));
    }
    if (e.getEventType() == HyperlinkEvent.EventType.EXITED) {
        jEditorPane.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
}

From source file:org.ut.biolab.medsavant.client.view.util.PeekingPanel.java

public PeekingPanel(String label, String borderLayoutPosition, JComponent panel, boolean isExpanded, int size) {

    final boolean isVertical = borderLayoutPosition.equals(BorderLayout.EAST)
            || borderLayoutPosition.equals(BorderLayout.WEST);

    this.setAnimated(false);

    if (borderLayoutPosition.equals(BorderLayout.NORTH)) {
        dockedSide = DockedSide.NORTH;/*from w w  w.  ja  v  a2  s .  c  o m*/
        this.setDirection(JXCollapsiblePane.Direction.UP);
    } else if (borderLayoutPosition.equals(BorderLayout.SOUTH)) {
        dockedSide = DockedSide.SOUTH;
        this.setDirection(JXCollapsiblePane.Direction.DOWN);
    } else if (borderLayoutPosition.equals(BorderLayout.EAST)) {
        dockedSide = DockedSide.EAST;
        this.setDirection(JXCollapsiblePane.Direction.RIGHT);
    } else {
        dockedSide = DockedSide.WEST;
        this.setDirection(JXCollapsiblePane.Direction.LEFT);
    }

    this.setLayout(new BorderLayout());
    this.panel = panel;

    if (isVertical) {
        panel.setPreferredSize(new Dimension(size, 999));
    } else {
        panel.setPreferredSize(new Dimension(999, size));
    }
    titlePanel = new JPanel();

    titlePanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    titlePanel.setBorder(ViewUtil.getTinyBorder());
    if (isVertical) {
        titlePanel.setLayout(new BoxLayout(titlePanel, BoxLayout.Y_AXIS));
    } else {
        titlePanel.setLayout(new BoxLayout(titlePanel, BoxLayout.X_AXIS));
    }
    titlePanel.add(Box.createHorizontalGlue());

    this.titleString = label.toUpperCase();
    title = new JLabel(" ");//titleString);

    title.setForeground(Color.darkGray);
    if (borderLayoutPosition.equals(BorderLayout.EAST)) {
        title.setUI(new VerticalLabelUI(true));
    } else if (borderLayoutPosition.equals(BorderLayout.WEST)) {
        title.setUI(new VerticalLabelUI(false));
    }
    titlePanel.add(title);

    if (!isVertical) {
        titlePanel.add(Box.createHorizontalGlue());
    }

    titlePanel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            toggleExpanded();
        }
    });

    this.add(titlePanel, borderLayoutPosition);
    this.add(panel, BorderLayout.CENTER);

    setExpanded(isExpanded);
}

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

public SettingsPanelServer(String tabName) {
    super(tabName);

    initComponents();/*  w  w w.ja  va  2  s .c o  m*/

    addTask(TaskConstants.SETTINGS_SERVER_BACKUP, "Backup Config",
            "Backup your server configuration to an XML file. The backup includes channels, alerts, code templates, server properties, global scripts, and plugin properties.",
            "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_disk.png")));
    addTask(TaskConstants.SETTINGS_SERVER_RESTORE, "Restore Config",
            "Restore your server configuration from a server configuration XML file. This will remove and restore your channels, alerts, code templates, server properties, global scripts, and plugin properties.",
            "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_go.png")));
    addTask(TaskConstants.SETTINGS_CLEAR_ALL_STATS, "Clear All Statistics",
            "Reset the current and lifetime statistics for all channels.", "",
            new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/chart_bar_delete.png")));

    provideUsageStatsMoreInfoLabel.setToolTipText(UIConstants.PRIVACY_TOOLTIP);
    provideUsageStatsMoreInfoLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    queueBufferSizeField.setDocument(new MirthFieldConstraints(8, false, false, true));
    smtpTimeoutField.setDocument(new MirthFieldConstraints(0, false, false, false));

    defaultMetaDataColumns = new ArrayList<MetaDataColumn>();
}

From source file:com.antelink.sourcesquare.gui.view.ExitSourceSquareView.java

/**
 * Create the frame.//  ww  w  .  j a  v  a 2 s .c o m
 */
public ExitSourceSquareView() {
    setIconImage(Toolkit.getDefaultToolkit().getImage(SourceSquareView.class.getResource("/antelink.png")));
    setTitle("SourceSquare");
    setResizable(false);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 500, 170);
    this.contentPane = new JPanel();
    this.contentPane.setBackground(Color.WHITE);
    this.contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(this.contentPane);

    this.mainPanel = new JPanel();
    this.mainPanel.setBackground(Color.WHITE);
    GroupLayout gl_contentPane = new GroupLayout(this.contentPane);
    gl_contentPane.setHorizontalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
            .addComponent(this.mainPanel, GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE));
    gl_contentPane.setVerticalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
            .addComponent(this.mainPanel, GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE));
    this.mainPanel.setLayout(new BoxLayout(this.mainPanel, BoxLayout.Y_AXIS));

    JPanel panel_1 = new JPanel();
    panel_1.setBackground(Color.WHITE);
    this.mainPanel.add(panel_1);
    panel_1.setLayout(new BorderLayout(0, 0));

    JPanel panel = new JPanel();
    panel.setLayout(new FlowLayout(FlowLayout.CENTER, 50, 20));
    panel.setBackground(Color.WHITE);
    panel_1.add(panel, BorderLayout.SOUTH);

    Image openButtonImage = Toolkit.getDefaultToolkit()
            .getImage(SourceSquareView.class.getResource("/OpenButton.png"));
    this.openButtonLabel = new JLabel(new ImageIcon(openButtonImage));
    this.openButtonLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    panel.add(this.openButtonLabel);

    JLabel exitLabel = new JLabel("<html><b>Closing this window will quit the application</b></html>");
    exitLabel.setFont(new Font("Helvetica", Font.PLAIN, 13));

    JLabel explainLabel = new JLabel("<html>(You won't be able to see or publish your results anymore)</html>");
    explainLabel.setFont(new Font("Helvetica", Font.PLAIN, 13));

    JPanel textPanel = new JPanel();
    textPanel.setBackground(Color.WHITE);
    textPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0));

    textPanel.add(exitLabel, BorderLayout.CENTER);
    textPanel.add(explainLabel, BorderLayout.CENTER);

    panel_1.add(textPanel, BorderLayout.CENTER);

    CopyrightPanel copyrightPanel = new CopyrightPanel();
    copyrightPanel.setBackground(Color.WHITE);
    this.mainPanel.add(copyrightPanel);
    this.contentPane.setLayout(gl_contentPane);

    setLocationRelativeTo(null);
}