Neither the tooltip (showing the address of the target hyperlink) nor the action when clicked occurs automatically, you must encode it: for the first register the panel using ToolTipManager, for the latter register the HyperlinkListener, something like:
final JEditorPane pane = new JEditorPane("http://swingx.java.net"); pane.setEditable(false); ToolTipManager.sharedInstance().registerComponent(pane); HyperlinkListener l = new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { if (HyperlinkEvent.EventType.ACTIVATED == e.getEventType()) { try { pane.setPage(e.getURL()); } catch (IOException e1) { e1.printStackTrace(); } } } }; pane.addHyperlinkListener(l);
An example of opening a page in the same panel. If you want to activate the default browser / mail client, ask the Desktop (new for jdk1.6) to do it for you
source share