JLabel label = new JLabel("<HTML><U>YOUR TEXT HERE</U></HTML>"); label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
JLabel label = new JLabel("http://stackoverflow.com"); label.setCursor(new Cursor(Cursor.HAND_CURSOR));
String project = "https://github.com/deathmarine/Luyten/"; JLabel link = new JLabel("<HTML><FONT color=\"#000099\"><U>" + project + "</U></FONT></HTML>"); link.setCursor(new Cursor(Cursor.HAND_CURSOR)); link.addMouseListener(new LinkListener(project, link)); pane.add(link); String procyon = "https://bitbucket.org/mstrobel/procyon"; link = new JLabel("<HTML><FONT color=\"#000099\"><U>" + procyon + "</U></FONT></HTML>"); link.setCursor(new Cursor(Cursor.HAND_CURSOR)); link.addMouseListener(new LinkListener(procyon, link)); pane.add(link); String rsyntax = "https://github.com/bobbylight/RSyntaxTextArea"; link = new JLabel("<HTML><FONT color=\"#000099\"><U>" + rsyntax + "</U></FONT></HTML>"); link.setCursor(new Cursor(Cursor.HAND_CURSOR)); link.addMouseListener(new LinkListener(rsyntax, link)); pane.add(link);
final String issue = "https://github.com/deathmarine/Luyten/issues"; final JLabel link = new JLabel("<HTML>Submit to <FONT color=\"#000099\"><U>" + issue + "</U></FONT></HTML>"); link.setCursor(new Cursor(Cursor.HAND_CURSOR)); link.addMouseListener(new MouseAdapter() { @Override
linkText.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); linkText.addMouseListener(new MouseAdapter() { public void mouseClicked (MouseEvent e) {
assert ml != null; c.setText(htmlIfy(linkIfy(c.getText()))); c.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); c.addMouseListener(ml);
configSaveDirLabel.setText(workingDir); configSaveDirLabel.setForeground(Color.BLUE); configSaveDirLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } catch (Exception e) { } configSaveDirLabel.setToolTipText(configSaveDirLabel.getText());
import java.awt.Cursor; import java.awt.Desktop; import java.awt.EventQueue; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; private void goWebsite(JLabel website, final String url, String text) { website.setText("<html> Website : <a href=\"\">"+text+"</a></html>"); website.setCursor(new Cursor(Cursor.HAND_CURSOR)); website.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { Desktop.getDesktop().browse(new URI(url)); } catch (URISyntaxException | IOException ex) { //It looks like there's a problem } } }); }
public ReaderBottomPanel() { BorderLayout layout = new BorderLayout(); this.setLayout(layout); statusLabel = new JLabel(); statusLabel.setText("Ready"); this.add(statusLabel, BorderLayout.WEST); logLabel = new JLabel(); logLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); logLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { Window viewer = LogDialog.instance().getOwner(); // show the log window LogDialog.instance().setSize(800, 400); LogDialog.instance().setVisible(true); LogDialog.instance().setLocation(viewer.getLocationOnScreen().x + viewer.getWidth() / 2, viewer.getLocationOnScreen().y + viewer.getHeight() / 2); } }); this.add(logLabel, BorderLayout.EAST); this.setBorder(new EmptyBorder(0, 5, 0, 5)); this.setPreferredSize(new Dimension(1000, 24)); }
lblCount.setText("999"); lblCount.setToolTipText("Number of all cards in this area."); lblCount.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); lblCount.setFocusable(false); lblCount.setInheritsPopupMenu(false); lblLandCount.setToolTipText("Number of lands."); lblLandCount.setVerticalAlignment(javax.swing.SwingConstants.TOP); lblLandCount.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); lblLandCount.setFocusable(false); lblLandCount.setInheritsPopupMenu(false); lblCreatureCount.setToolTipText("Number of creatures."); lblCreatureCount.setVerticalAlignment(javax.swing.SwingConstants.TOP); lblCreatureCount.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); lblCreatureCount.setFocusable(false); lblCreatureCount.setInheritsPopupMenu(false);
ComponentBorder loaderInTextfield = new ComponentBorder(this.loader, 17, 1); loaderInTextfield.install(this.textFieldAddress); this.loader.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
@Override public void mouseExited(MouseEvent e) { label.setCursor(oldCursor); } @Override
remainingRowsLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); remainingRowsLabel.setMaximumSize(null); remainingRowsLabel.setMinimumSize(new java.awt.Dimension(106, 14)); sentRowsLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); sentRowsLabel.setMaximumSize(null); sentRowsLabel.setMinimumSize(new java.awt.Dimension(106, 14)); rowsLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); rowsLabel.setMinimumSize(new java.awt.Dimension(106, 14)); rowsLabel.setPreferredSize(new java.awt.Dimension(106, 14));
private JComponent createResetSearchButton() { final JLabel resetSearchFieldIcon = new JLabel("X"); resetSearchFieldIcon.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); resetSearchFieldIcon.setBorder(WidgetUtils.BORDER_EMPTY); resetSearchFieldIcon.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(final MouseEvent e) { resetSearch(); } }); return resetSearchFieldIcon; }
public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } });
@Override public void mouseEntered( final MouseEvent e ) { linkLabel.setForeground( Color.BLUE ); linkLabel.setCursor( new Cursor( Cursor.HAND_CURSOR ) ); }
@ScriptFunction @Override public void setCursor(Cursor aCursor) { super.setCursor(aCursor); }
public static JLabel createIconButton(ImageIcon i) { JLabel b = new JLabel(); b.setBorder(null); b.setOpaque(false); b.setPreferredSize(new Dimension(i.getIconWidth(), i.getIconHeight())); b.setCursor(new Cursor(Cursor.HAND_CURSOR)); b.setIcon(i); return b; }
public void setLabel(JLabel newValue) { if (label != null) { label.removeMouseListener(handler); label.removeMouseMotionListener(handler); label.setCursor(Cursor.getDefaultCursor()); } label = newValue; if (label != null) { label.addMouseListener(handler); label.addMouseMotionListener(handler); } }
private void initComponents() { createComponents(); label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); label.addMouseListener(new LabelMouseListener()); label.setToolTipText(SwingMessages.getString("JDateHourTextField.2")); //$NON-NLS-1$ popupMenu.add(buildEditorPanel()); popupMenu.pack(); this.add(label); this.addComponentListener(new DateTextFieldComponentListener()); }