Here you can find the source of addHyperLinkListener(JEditorPane editorPane)
public static void addHyperLinkListener(JEditorPane editorPane)
//package com.java2s; //License from project: Apache License import javax.swing.*; import javax.swing.event.HyperlinkEvent; import java.awt.*; public class Main { public static void addHyperLinkListener(JEditorPane editorPane) { editorPane.addHyperlinkListener(hyperlinkListener -> { if (HyperlinkEvent.EventType.ACTIVATED.equals(hyperlinkListener.getEventType())) { Desktop desktop = Desktop.getDesktop(); try { desktop.browse(hyperlinkListener.getURL().toURI()); } catch (Exception ex) { ex.printStackTrace(); }//from www. j a v a 2s . c o m } }); } }