diff options
| author | 2014-08-22 01:25:52 -0400 | |
|---|---|---|
| committer | 2014-08-22 01:25:52 -0400 | |
| commit | 32b7ea70ff20d3584f8021e598141c20c2200398 (patch) | |
| tree | bb5b26427c76b9e31ff146e952e765c9c36b3383 /src/cuchaz/enigma/gui/SelectionHighlightPainter.java | |
| parent | fixed constructor references in call graph searches (diff) | |
| download | enigma-fork-32b7ea70ff20d3584f8021e598141c20c2200398.tar.gz enigma-fork-32b7ea70ff20d3584f8021e598141c20c2200398.tar.xz enigma-fork-32b7ea70ff20d3584f8021e598141c20c2200398.zip | |
added show token effects
Diffstat (limited to 'src/cuchaz/enigma/gui/SelectionHighlightPainter.java')
| -rw-r--r-- | src/cuchaz/enigma/gui/SelectionHighlightPainter.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/gui/SelectionHighlightPainter.java b/src/cuchaz/enigma/gui/SelectionHighlightPainter.java new file mode 100644 index 0000000..35f9451 --- /dev/null +++ b/src/cuchaz/enigma/gui/SelectionHighlightPainter.java | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2014 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Public License v3.0 | ||
| 5 | * which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/gpl.html | ||
| 7 | * | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma.gui; | ||
| 12 | |||
| 13 | import java.awt.BasicStroke; | ||
| 14 | import java.awt.Color; | ||
| 15 | import java.awt.Graphics; | ||
| 16 | import java.awt.Graphics2D; | ||
| 17 | import java.awt.Rectangle; | ||
| 18 | import java.awt.Shape; | ||
| 19 | |||
| 20 | import javax.swing.text.Highlighter; | ||
| 21 | import javax.swing.text.JTextComponent; | ||
| 22 | |||
| 23 | public class SelectionHighlightPainter implements Highlighter.HighlightPainter | ||
| 24 | { | ||
| 25 | @Override | ||
| 26 | public void paint( Graphics g, int start, int end, Shape shape, JTextComponent text ) | ||
| 27 | { | ||
| 28 | // draw a thick border | ||
| 29 | Graphics2D g2d = (Graphics2D)g; | ||
| 30 | Rectangle bounds = BoxHighlightPainter.getBounds( text, start, end ); | ||
| 31 | g2d.setColor( Color.black ); | ||
| 32 | g2d.setStroke( new BasicStroke( 2.0f ) ); | ||
| 33 | g2d.drawRoundRect( bounds.x, bounds.y, bounds.width, bounds.height, 4, 4 ); | ||
| 34 | } | ||
| 35 | } | ||