Java Code Examples for javax.swing.JEditorPane#removeHyperlinkListener()

The following examples show how to use javax.swing.JEditorPane#removeHyperlinkListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GHelpHTMLEditorKit.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Override
public void install(JEditorPane c) {
	super.install(c);

	delegateListeners = c.getHyperlinkListeners();
	for (HyperlinkListener listener : delegateListeners) {
		c.removeHyperlinkListener(listener);
	}

	resolverHyperlinkListener = new ResolverHyperlinkListener();
	c.addHyperlinkListener(resolverHyperlinkListener);

	// add a listener to report trace information
	c.addPropertyChangeListener(new PropertyChangeListener() {
		@Override
		public void propertyChange(PropertyChangeEvent evt) {
			String propertyName = evt.getPropertyName();
			if ("page".equals(propertyName)) {
				Msg.trace(this, "Page loaded: " + evt.getNewValue());
			}
		}
	});
}
 
Example 2
Source File: GHelpHTMLEditorKit.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public void deinstall(JEditorPane c) {

	c.removeHyperlinkListener(resolverHyperlinkListener);

	for (HyperlinkListener listener : delegateListeners) {
		c.addHyperlinkListener(listener);
	}

	super.deinstall(c);
}