// enable rollover
linkList.setRolloverEnabled(true);
// set a renderer delegating to a HyperlinkProvider configured
// with raw HyperlinkAction
linkList.setCellRenderer(new DefaultListRenderer(new HyperlinkProvider(
new HyperlinkAction())));
//</snip>
DemoUtils.setSnippet("List with hyperlink renderer", linkList);
// <snip> Tree with hyperlink renderer
// model containing URIs wrapped in treeNodes
DefaultMutableTreeNode root = new DefaultMutableTreeNode(
new URI("http://java.net"));
for (int i = 0; i < linkList.getElementCount(); i++) {
root.add(new DefaultMutableTreeNode(linkList.getElementAt(i)));
}
linkTree.setModel(new DefaultTreeModel(root));
linkTree.expandAll();
// enable rollover
linkTree.setRolloverEnabled(true);
// set a renderer delegating to wrapper around a HyperlinkProvider
// configured with a raw HyperlinkAction
linkTree.setCellRenderer(new DefaultTreeRenderer(new WrappingProvider(
new HyperlinkProvider(new HyperlinkAction()))));
// </snip>
DemoUtils.setSnippet("Tree with hyperlink renderer", linkTree);
}