diff options
Diffstat (limited to 'src/cuchaz/enigma/gui/BoxHighlightPainter.java')
| -rw-r--r-- | src/cuchaz/enigma/gui/BoxHighlightPainter.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/cuchaz/enigma/gui/BoxHighlightPainter.java b/src/cuchaz/enigma/gui/BoxHighlightPainter.java index 22db28b..b9474ff 100644 --- a/src/cuchaz/enigma/gui/BoxHighlightPainter.java +++ b/src/cuchaz/enigma/gui/BoxHighlightPainter.java | |||
| @@ -19,10 +19,16 @@ import javax.swing.text.BadLocationException; | |||
| 19 | import javax.swing.text.Highlighter; | 19 | import javax.swing.text.Highlighter; |
| 20 | import javax.swing.text.JTextComponent; | 20 | import javax.swing.text.JTextComponent; |
| 21 | 21 | ||
| 22 | public class BoxHighlightPainter implements Highlighter.HighlightPainter | 22 | public abstract class BoxHighlightPainter implements Highlighter.HighlightPainter |
| 23 | { | 23 | { |
| 24 | private static final Color FillColor = new Color( 230, 230, 230 ); | 24 | private Color m_fillColor; |
| 25 | private static final Color BorderColor = new Color( 100, 100, 100 ); | 25 | private Color m_borderColor; |
| 26 | |||
| 27 | protected BoxHighlightPainter( Color fillColor, Color borderColor ) | ||
| 28 | { | ||
| 29 | m_fillColor = fillColor; | ||
| 30 | m_borderColor = borderColor; | ||
| 31 | } | ||
| 26 | 32 | ||
| 27 | @Override | 33 | @Override |
| 28 | public void paint( Graphics g, int start, int end, Shape shape, JTextComponent text ) | 34 | public void paint( Graphics g, int start, int end, Shape shape, JTextComponent text ) |
| @@ -39,11 +45,11 @@ public class BoxHighlightPainter implements Highlighter.HighlightPainter | |||
| 39 | bounds.height -= 2; | 45 | bounds.height -= 2; |
| 40 | 46 | ||
| 41 | // fill the area | 47 | // fill the area |
| 42 | g.setColor( FillColor ); | 48 | g.setColor( m_fillColor ); |
| 43 | g.fillRoundRect( bounds.x, bounds.y, bounds.width, bounds.height, 4, 4 ); | 49 | g.fillRoundRect( bounds.x, bounds.y, bounds.width, bounds.height, 4, 4 ); |
| 44 | 50 | ||
| 45 | // draw a box around the area | 51 | // draw a box around the area |
| 46 | g.setColor( BorderColor ); | 52 | g.setColor( m_borderColor ); |
| 47 | g.drawRoundRect( bounds.x, bounds.y, bounds.width, bounds.height, 4, 4 ); | 53 | g.drawRoundRect( bounds.x, bounds.y, bounds.width, bounds.height, 4, 4 ); |
| 48 | } | 54 | } |
| 49 | catch( BadLocationException ex ) | 55 | catch( BadLocationException ex ) |