public interface Highlighter
An interface for an object that allows one to mark up the background with colored areas.
Modifier and Type | Interface and Description |
---|---|
static interface |
Highlighter.Highlight |
static interface |
Highlighter.HighlightPainter Highlight renderer. |
void install(JTextComponent c)
Called when the UI is being installed into the interface of a JTextComponent. This can be used to gain access to the model that is being navigated by the implementation of this interface.
c
- the JTextComponent editorvoid deinstall(JTextComponent c)
Called when the UI is being removed from the interface of a JTextComponent. This is used to unregister any listeners that were attached.
c
- the JTextComponent editorvoid paint(Graphics g)
Renders the highlights.
g
- the graphics context.Object addHighlight(int p0, int p1, Highlighter.HighlightPainter p) throws BadLocationException
Adds a highlight to the view. Returns a tag that can be used to refer to the highlight.
p0
- the beginning of the range >= 0p1
- the end of the range >= p0p
- the painter to use for the actual highlightingBadLocationException
- for an invalid range specificationvoid removeHighlight(Object tag)
Removes a highlight from the view.
tag
- which highlight to removevoid removeAllHighlights()
Removes all highlights this highlighter is responsible for.
void changeHighlight(Object tag, int p0, int p1) throws BadLocationException
Changes the given highlight to span a different portion of the document. This may be more efficient than a remove/add when a selection is expanding/shrinking (such as a sweep with a mouse) by damaging only what changed.
tag
- which highlight to changep0
- the beginning of the range >= 0p1
- the end of the range >= p0BadLocationException
- for an invalid range specificationHighlighter.Highlight[] getHighlights()
Fetches the current list of highlights.
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.