Java tutorial
//package com.java2s; //License from project: Apache License import java.util.*; import javax.swing.text.*; import javax.swing.text.Highlighter.Highlight; public class Main { public static void removeHightlights(final Collection<Highlighter.HighlightPainter> sample, Highlighter highlighter) { for (Highlight highlight : highlighter.getHighlights()) { if (sample.contains(highlight.getPainter())) { highlighter.removeHighlight(highlight); } } } public static void removeHightlights(final Highlighter.HighlightPainter sample, Highlighter highlighter) { for (Highlight highlight : highlighter.getHighlights()) { if (sample == highlight.getPainter()) { highlighter.removeHighlight(highlight); } } } }