/** * Removes a line highlight. * * @param tag The tag of the line highlight to remove. * @see #addLineHighlight(int, Color) */ public void removeLineHighlight(Object tag) { if (tag instanceof LineHighlightInfo) { lineHighlights.remove(tag); repaintLine((LineHighlightInfo)tag); } }
/** * Highlights the specified line. * * @param line The line to highlight. * @param color The color to highlight with. * @return A tag for the highlight. * @throws BadLocationException If <code>line</code> is not a valid line * number. * @see #removeLineHighlight(Object) */ public Object addLineHighlight(int line, Color color) throws BadLocationException { int offs = textArea.getLineStartOffset(line); LineHighlightInfo lhi = new LineHighlightInfo( textArea.getDocument().createPosition(offs), color); if (lineHighlights==null) { lineHighlights = new ArrayList<LineHighlightInfo>(1); } int index = Collections.binarySearch(lineHighlights, lhi, comparator); if (index<0) { // Common case index = -(index+1); } lineHighlights.add(index, lhi); repaintLine(lhi); return lhi; }
/** * Removes a line highlight. * * @param tag The tag of the line highlight to remove. * @see #addLineHighlight(int, Color) */ public void removeLineHighlight(Object tag) { if (tag instanceof LineHighlightInfo) { lineHighlights.remove(tag); repaintLine((LineHighlightInfo)tag); } }
/** * Removes a line highlight. * * @param tag The tag of the line highlight to remove. * @see #addLineHighlight(int, Color) */ public void removeLineHighlight(Object tag) { if (tag instanceof LineHighlightInfo) { lineHighlights.remove(tag); repaintLine((LineHighlightInfo)tag); } }
/** * Removes a line highlight. * * @param tag The tag of the line highlight to remove. * @see #addLineHighlight(int, Color) */ public void removeLineHighlight(Object tag) { if (tag instanceof LineHighlightInfo) { lineHighlights.remove(tag); repaintLine((LineHighlightInfo)tag); } }
/** * Highlights the specified line. * * @param line The line to highlight. * @param color The color to highlight with. * @return A tag for the highlight. * @throws BadLocationException If <code>line</code> is not a valid line * number. * @see #removeLineHighlight(Object) */ public Object addLineHighlight(int line, Color color) throws BadLocationException { int offs = textArea.getLineStartOffset(line); LineHighlightInfo lhi = new LineHighlightInfo( textArea.getDocument().createPosition(offs), color); if (lineHighlights==null) { lineHighlights = new ArrayList(1); } int index = Collections.binarySearch(lineHighlights, lhi); if (index<0) { // Common case index = -(index+1); } lineHighlights.add(index, lhi); repaintLine(lhi); return lhi; }
/** * Highlights the specified line. * * @param line The line to highlight. * @param color The color to highlight with. * @return A tag for the highlight. * @throws BadLocationException If <code>line</code> is not a valid line * number. * @see #removeLineHighlight(Object) */ public Object addLineHighlight(int line, Color color) throws BadLocationException { int offs = textArea.getLineStartOffset(line); LineHighlightInfo lhi = new LineHighlightInfo( textArea.getDocument().createPosition(offs), color); if (lineHighlights==null) { lineHighlights = new ArrayList<LineHighlightInfo>(1); } int index = Collections.binarySearch(lineHighlights, lhi, comparator); if (index<0) { // Common case index = -(index+1); } lineHighlights.add(index, lhi); repaintLine(lhi); return lhi; }
/** * Highlights the specified line. * * @param line The line to highlight. * @param color The color to highlight with. * @return A tag for the highlight. * @throws BadLocationException If <code>line</code> is not a valid line * number. * @see #removeLineHighlight(Object) */ public Object addLineHighlight(int line, Color color) throws BadLocationException { int offs = textArea.getLineStartOffset(line); LineHighlightInfo lhi = new LineHighlightInfo( textArea.getDocument().createPosition(offs), color); if (lineHighlights==null) { lineHighlights = new ArrayList(1); } int index = Collections.binarySearch(lineHighlights, lhi); if (index<0) { // Common case index = -(index+1); } lineHighlights.add(index, lhi); repaintLine(lhi); return lhi; }