/** * {@inheritDoc} */ @Override public void setPaint(Paint paint) { super.setPaint(paint); if (paint instanceof Color) { borderColor = ((Color)paint).darker(); } }
/** * Creates a new highlight painter. * * @param paint The <code>Paint</code> (usually a * <code>java.awt.Color</code>) with which to paint the * highlights. * @param rounded Whether to use rounded edges on the highlights. * @param alpha The alpha value to use when painting highlights. This * value should be in the range <code>0.0f</code> (completely * transparent) through <code>1.0f</code> (opaque). */ public ChangeableHighlightPainter(Paint paint, boolean rounded, float alpha) { setPaint(paint); setRoundedEdges(rounded); setAlpha(alpha); }
/** * {@inheritDoc} */ @Override public void paintLayeredHighlights(Graphics g, int p0, int p1, Shape viewBounds, JTextComponent editor, View view) { int start = getStartOffset(); int end = getEndOffset(); end++; // Workaround for Java highlight issues // Restrict the region to what we represent p0 = Math.max(start, p0); p1 = Math.min(end, p1); if (getColor()!=null && getPainter() instanceof ChangeableHighlightPainter) { ((ChangeableHighlightPainter)getPainter()).setPaint(getColor()); } // Paint the appropriate region using the painter and union // the effected region with our bounds. union(((LayeredHighlighter.LayerPainter)getPainter()).paintLayer( g, p0, p1, viewBounds, editor, view)); }
/** * {@inheritDoc} */ @Override public void setPaint(Paint paint) { super.setPaint(paint); if (paint instanceof Color) { borderColor = ((Color)paint).darker(); } }
/** * Creates a new highlight painter. * * @param paint The <code>Paint</code> (usually a * <code>java.awt.Color</code>) with which to paint the * highlights. * @param rounded Whether to use rounded edges on the highlights. * @param alpha The alpha value to use when painting highlights. This * value should be in the range <code>0.0f</code> (completely * transparent) through <code>1.0f</code> (opaque). */ public ChangeableHighlightPainter(Paint paint, boolean rounded, float alpha) { setPaint(paint); setRoundedEdges(rounded); setAlpha(alpha); }
/** * Creates a new highlight painter. * * @param paint The <code>Paint</code> (usually a * <code>java.awt.Color</code>) with which to paint the * highlights. * @param rounded Whether to use rounded edges on the highlights. * @param alpha The alpha value to use when painting highlights. This * value should be in the range <code>0.0f</code> (completely * transparent) through <code>1.0f</code> (opaque). */ public ChangeableHighlightPainter(Paint paint, boolean rounded, float alpha) { setPaint(paint); setRoundedEdges(rounded); setAlpha(alpha); }
/** * Sets the color used for "mark all." This fires a property change of * type {@link #MARK_ALL_COLOR_PROPERTY}. * * @param color The color to use for "mark all." * @see #getMarkAllHighlightColor() */ public void setMarkAllHighlightColor(Color color) { Color old = (Color)markAllHighlightPainter.getPaint(); if (old!=null && !old.equals(color)) { markAllHighlightPainter.setPaint(color); if (markedWord!=null) repaint(); // Repaint if words are highlighted. firePropertyChange(MARK_ALL_COLOR_PROPERTY, old, color); } }
/** * Creates a new highlight painter. * * @param paint The <code>Paint</code> (usually a * <code>java.awt.Color</code>) with which to paint the * highlights. * @param rounded Whether to use rounded edges on the highlights. * @param alpha The alpha value to use when painting highlights. This * value should be in the range <code>0.0f</code> (completely * transparent) through <code>1.0f</code> (opaque). */ public ChangeableHighlightPainter(Paint paint, boolean rounded, float alpha) { setPaint(paint); setRoundedEdges(rounded); setAlpha(alpha); }
/** * Sets the color used for "mark all." This fires a property change of * type {@link #MARK_ALL_COLOR_PROPERTY}. * * @param color The color to use for "mark all." * @see #getMarkAllHighlightColor() */ public void setMarkAllHighlightColor(Color color) { Color old = (Color)markAllHighlightPainter.getPaint(); if (old!=null && !old.equals(color)) { markAllHighlightPainter.setPaint(color); if (markedWord!=null) repaint(); // Repaint if words are highlighted. firePropertyChange(MARK_ALL_COLOR_PROPERTY, old, color); } }
/** * {@inheritDoc} */ @Override public void paintLayeredHighlights(Graphics g, int p0, int p1, Shape viewBounds, JTextComponent editor, View view) { int start = getStartOffset(); int end = getEndOffset(); end++; // Workaround for Java highlight issues // Restrict the region to what we represent p0 = Math.max(start, p0); p1 = Math.min(end, p1); if (getColor()!=null && getPainter() instanceof ChangeableHighlightPainter) { ((ChangeableHighlightPainter)getPainter()).setPaint(getColor()); } // Paint the appropriate region using the painter and union // the effected region with our bounds. union(((LayeredHighlighter.LayerPainter)getPainter()).paintLayer( g, p0, p1, viewBounds, editor, view)); }