Class DarkHighlightPainter
- java.lang.Object
-
- javax.swing.text.LayeredHighlighter.LayerPainter
-
- javax.swing.text.DefaultHighlighter.DefaultHighlightPainter
-
- javax.swing.text.DefaultHighlighterDark.DarkHighlightPainter
-
- All Implemented Interfaces:
Highlighter.HighlightPainter
public class DarkHighlightPainter extends DefaultHighlighter.DefaultHighlightPainter
Note this class only sits inside this weird package because of a hack used inSwingUtilities2.useSelectedTextColor(Highlighter.Highlight, JTextComponent)
that makes it impossible for custom highlighters to use the correct text foreground specified byJTextComponent.getSelectedTextColor()
.
-
-
Constructor Summary
Constructors Constructor Description DarkHighlightPainter()
DarkHighlightPainter(Paint paint)
DarkHighlightPainter(Paint paint, boolean rounded)
DarkHighlightPainter(Paint paint, boolean rounded, float alpha)
-
Method Summary
Modifier and Type Method Description float
getAlpha()
Color
getColor()
Paint
getPaint(Component c, Shape bounds)
boolean
getRoundedEdges()
boolean
isEnabled()
boolean
isLineExtendingEnabled()
void
paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c)
Paints a highlight.Shape
paintLayer(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c, View view)
protected Rectangle
paintRoundedLayer(Graphics2D g, JTextComponent c, int offs0, int offs1, GraphicsContext context, boolean rounded, boolean extendLines, boolean isPaintingPreceding)
void
setAlpha(float alpha)
void
setEnabled(boolean enabled)
void
setLineExtendingEnabled(boolean enabled)
void
setPaint(Paint paint)
void
setRoundedEdges(boolean rounded)
-
-
-
Constructor Detail
-
DarkHighlightPainter
public DarkHighlightPainter()
-
DarkHighlightPainter
public DarkHighlightPainter(Paint paint)
-
DarkHighlightPainter
public DarkHighlightPainter(Paint paint, boolean rounded)
-
DarkHighlightPainter
public DarkHighlightPainter(Paint paint, boolean rounded, float alpha)
-
-
Method Detail
-
getRoundedEdges
public boolean getRoundedEdges()
-
setRoundedEdges
public void setRoundedEdges(boolean rounded)
-
getColor
public Color getColor()
- Overrides:
getColor
in classDefaultHighlighter.DefaultHighlightPainter
-
paint
public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c)
Paints a highlight.- Specified by:
paint
in interfaceHighlighter.HighlightPainter
- Overrides:
paint
in classDefaultHighlighter.DefaultHighlightPainter
- Parameters:
g
- the graphics contextoffs0
- the starting model offset >= 0offs1
- the ending model offset >= offs1bounds
- the bounding box for the highlightc
- the editor
-
getAlpha
public float getAlpha()
-
setPaint
public void setPaint(Paint paint)
-
setAlpha
public void setAlpha(float alpha)
-
paintLayer
public Shape paintLayer(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c, View view)
- Overrides:
paintLayer
in classDefaultHighlighter.DefaultHighlightPainter
-
paintRoundedLayer
protected Rectangle paintRoundedLayer(Graphics2D g, JTextComponent c, int offs0, int offs1, GraphicsContext context, boolean rounded, boolean extendLines, boolean isPaintingPreceding)
-
isLineExtendingEnabled
public boolean isLineExtendingEnabled()
-
setLineExtendingEnabled
public void setLineExtendingEnabled(boolean enabled)
-
isEnabled
public boolean isEnabled()
-
setEnabled
public void setEnabled(boolean enabled)
-
-