use of org.xhtmlrenderer.swing.LinkListener in project gate-core by GateNLP.
the class ControllerMetadataViewer method init.
@SuppressWarnings("rawtypes")
@Override
public Resource init() throws ResourceInstantiationException {
setLayout(new BorderLayout());
add(new JScrollPane(display), BorderLayout.CENTER);
try {
builder = builderFactory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
throw new ResourceInstantiationException("Unable to construct an XML parser", e);
}
if (Configuration.isTrue("xr.use.listeners", true)) {
List l = display.getMouseTrackingListeners();
for (Iterator i = l.iterator(); i.hasNext(); ) {
FSMouseListener listener = (FSMouseListener) i.next();
if (listener instanceof LinkListener) {
display.removeMouseTrackingListener(listener);
}
}
display.addMouseTrackingListener(new LinkListener() {
@Override
public void linkClicked(BasicPanel panel, String uri) {
// open any links in an actual web browser
MainFrame.getInstance().showHelpFrame(uri, null);
}
});
}
return this;
}
Aggregations