- Timestamp:
- 2012-02-23T18:32:58+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/UrlLabel.java
r2512 r5019 2 2 package org.openstreetmap.josm.tools; 3 3 4 import java.awt.event.MouseEvent; 5 import java.awt.event.MouseListener; 4 6 import javax.swing.JEditorPane; 5 7 import javax.swing.event.HyperlinkEvent; 6 8 import javax.swing.event.HyperlinkListener; 9 import static org.openstreetmap.josm.tools.I18n.tr; 7 10 8 11 /** … … 10 13 * @author Imi 11 14 */ 12 public class UrlLabel extends JEditorPane implements HyperlinkListener {15 public class UrlLabel extends JEditorPane implements HyperlinkListener, MouseListener { 13 16 14 17 private String url = ""; … … 17 20 public UrlLabel() { 18 21 addHyperlinkListener(this); 22 addMouseListener(this); 19 23 setEditable(false); 20 24 setOpaque(false); … … 39 43 setText("<html>" + description + "</html>"); 40 44 } 41 setToolTipText( url);45 setToolTipText(String.format("<html>%s<br/>%s</html>",url, tr("Right click = copy to clipboard"))); 42 46 } 43 47 … … 69 73 refresh(); 70 74 } 75 76 @Override 77 public void mouseClicked(MouseEvent e) { } 78 @Override 79 public void mousePressed(MouseEvent e) { } 80 @Override 81 public void mouseEntered(MouseEvent e) { } 82 @Override 83 public void mouseExited(MouseEvent e) { } 84 85 @Override 86 public void mouseReleased(MouseEvent e) { 87 if (e.getButton() == MouseEvent.BUTTON3) { 88 Utils.copyToClipboard(url); 89 } 90 } 91 71 92 }
Note:
See TracChangeset
for help on using the changeset viewer.