/**Class LinkTrace is used for listening to when a Hyperlink is clicked. *Internet Programming 1 - Course *@author Martin Carlsson */ import javax.swing.*; import javax.swing.event.*; public class LinkTrace implements HyperlinkListener { private JEditorPane pane; public LinkTrace(JEditorPane pane) { this.pane=pane; // Reference to the pane in the GUI class } /*Updates the hyperlink*/ public void hyperlinkUpdate(HyperlinkEvent hE) { if(hE.getEventType()==HyperlinkEvent.EventType.ACTIVATED) { try { pane.setPage(hE.getURL()); } catch(Exception e) { } } } } // End class LinkTrace