Here you can find the source of removeAllHighlightsUsingPainter(final JTextComponent textComponent, final Highlighter.HighlightPainter painter)
public static void removeAllHighlightsUsingPainter(final JTextComponent textComponent, final Highlighter.HighlightPainter painter)
//package com.java2s; //License from project: Open Source License import javax.swing.text.*; public class Main { public static void removeAllHighlightsUsingPainter(final JTextComponent textComponent, final Highlighter.HighlightPainter painter) { Highlighter highlighter = textComponent.getHighlighter(); for (Highlighter.Highlight highlight : highlighter.getHighlights()) { if (highlight.getPainter() == painter) { highlighter.removeHighlight(highlight); }/*from www . j av a2s. com*/ } } }