Clover coverage report - baseCode - 0.2.5 Coverage timestamp: Tue Apr 12 2005 11:31:58 EDT FRAMES NO FRAMES |
file stats: | LOC: | 92 |  | Methods: | 13
| NCLOC: | 58 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
JLinkLabel.java | 0% | 0% | 0% | 0% |

1 |  |
     package baseCode.gui;
2 |  |
3 |  |
     import java.awt.event.MouseEvent;
4 |  |
     import java.awt.event.MouseListener;
5 |  |
     import java.io.IOException;
6 |  |
7 |  |
     import javax.swing.JLabel;
8 |  |
9 |  |
     import baseCode.util.BrowserLauncher;
10 |  |
11 |  |
     /**
12 |  |
      * A clickable link label that contains a URL. When a mouse pointer is placed over it, it turns into a hand.
13 |  |
      *
14 |  |
      * @author Will Braynen
15 |  |
      * @version $Id: JLinkLabel.java,v 1.9 2004/08/11 21:22:02 hkl7 Exp $
16 |  |
      */
17 |  |
     public class JLinkLabel extends JLabel implements MouseListener {
18 |  |
19 |  |
         protected String m_url = null;
20 |  |
21 |  |
         protected String m_text = "";
22 |  |
23 |  |
         /** Creates a new instance of JLinkLabel */
24 | 0 |
         public JLinkLabel() {
25 | 0 |
             super();
26 |  |
         }
27 |  |
28 | 0 |
         public JLinkLabel(String text) {
29 | 0 |
             this();
30 | 0 |
             setText(text);
31 |  |
         }
32 |  |
33 | 0 |
         public JLinkLabel(String text, String url) {
34 | 0 |
             this();
35 | 0 |
             setText(text, url);
36 |  |
         }
37 |  |
38 | 0 |
         public void setText(String text) {
39 | 0 |
             if (m_url != null) {
40 | 0 |
                 setText(text, m_url);
41 |  |
             } else {
42 | 0 |
                 setText(text, text);
43 |  |
             }
44 |  |
         }
45 |  |
46 |  |
         /**
47 |  |
          * @param url
48 |  |
          */
49 | 0 |
         public void setURL(String url) {
50 | 0 |
             setText(m_text, url);
51 |  |
         }
52 |  |
53 |  |
         /**
54 |  |
          * @return
55 |  |
          */
56 | 0 |
         public String getURL() {
57 | 0 |
             return m_url;
58 |  |
         }
59 |  |
60 | 0 |
         public void setText(String text, String url) {
61 | 0 |
             m_text = text;
62 | 0 |
             m_url = url;
63 | 0 |
             super.setText("<html><a href=\"" + url + "\">" + text + "</a></html>");
64 |  |
         }
65 |  |
66 | 0 |
         public String toString() {
67 | 0 |
             return "<html><a href=\"" + m_url + "\">" + m_text + "</a></html>";
68 |  |
         }
69 |  |
70 | 0 |
         public void mouseClicked(MouseEvent e) {
71 | 0 |
             if (m_url != null) {
72 | 0 |
                 try {
73 | 0 |
                     BrowserLauncher.openURL(m_url);
74 |  |
                 } catch (IOException ex) {
75 | 0 |
                     GuiUtil.error("Could not open a web browser window.");
76 |  |
                 }
77 |  |
             }
78 |  |
         }
79 |  |
80 | 0 |
         public void mouseEntered(MouseEvent e) {
81 |  |
         }
82 |  |
83 | 0 |
         public void mouseExited(MouseEvent e) {
84 |  |
         }
85 |  |
86 | 0 |
         public void mousePressed(MouseEvent e) {
87 |  |
         }
88 |  |
89 | 0 |
         public void mouseReleased(MouseEvent e) {
90 |  |
         }
91 |  |
92 |  |
     }