public class HyperlinkKeyNavigator extends Object implements DocumentListener, PropertyChangeListener
JEditorPane
showing HTML content.
There is already similar functionality built into the HTML editor kit, but the default keyboard keys are impractical, the implemetation does not work well and the corresponding actions are not documented, so I decided to roll my own implementation.
Modifier and Type | Class and Description |
---|---|
protected class |
HyperlinkKeyNavigator.ActivateLinkAction |
protected class |
HyperlinkKeyNavigator.MoveLinkAction |
Modifier and Type | Field and Description |
---|---|
protected HyperlinkKeyNavigator.ActivateLinkAction |
activateLinkAction |
protected Element |
currentElement |
protected HTMLDocument |
document |
protected JEditorPane |
editor |
protected DefaultHighlighter.DefaultHighlightPainter |
highlightPainter |
protected Object |
highlightTag |
protected HyperlinkKeyNavigator.MoveLinkAction |
nextLinkAction |
protected HyperlinkKeyNavigator.MoveLinkAction |
previousLinkAction |
Constructor and Description |
---|
HyperlinkKeyNavigator() |
HyperlinkKeyNavigator(Color highlightColor) |
Modifier and Type | Method and Description |
---|---|
void |
changedUpdate(DocumentEvent e) |
protected void |
createHighlightPainter(Color highlightColor) |
protected Element |
getFirstLinkAfter(int position,
Element elem)
Searches the first
a href element after the given position. |
protected Element |
getFirstLinkBefore(int position,
Element elem)
Searches the first
a href element after the given position. |
Color |
getHighlightColor() |
void |
insertUpdate(DocumentEvent e) |
void |
propertyChange(PropertyChangeEvent event) |
protected void |
removeHighlight() |
void |
removeUpdate(DocumentEvent e) |
protected void |
resetSelection() |
protected void |
setHighlight(int startOffset,
int endOffset) |
void |
setHighlightColor(Color highlightColor) |
void |
setTargetEditor(JEditorPane _editor) |
protected Element currentElement
protected Object highlightTag
protected JEditorPane editor
protected HTMLDocument document
protected HyperlinkKeyNavigator.MoveLinkAction nextLinkAction
protected HyperlinkKeyNavigator.MoveLinkAction previousLinkAction
protected HyperlinkKeyNavigator.ActivateLinkAction activateLinkAction
protected DefaultHighlighter.DefaultHighlightPainter highlightPainter
public HyperlinkKeyNavigator()
public HyperlinkKeyNavigator(Color highlightColor)
public void setTargetEditor(JEditorPane _editor)
public void setHighlightColor(Color highlightColor)
public Color getHighlightColor()
protected void createHighlightPainter(Color highlightColor)
protected void setHighlight(int startOffset, int endOffset)
protected void removeHighlight()
public void propertyChange(PropertyChangeEvent event)
propertyChange
in interface PropertyChangeListener
public void changedUpdate(DocumentEvent e)
changedUpdate
in interface DocumentListener
public void insertUpdate(DocumentEvent e)
insertUpdate
in interface DocumentListener
public void removeUpdate(DocumentEvent e)
removeUpdate
in interface DocumentListener
protected void resetSelection()
protected Element getFirstLinkAfter(int position, Element elem)
a href
element after the given position.null
if there is no such element.Copyright © 2001-2013 the JGloss developers. All Rights Reserved.