diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-08-12 13:27:52 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-08-12 13:27:52 +0000 |
commit | 32bb0e9c211961fbade190535b8041ece5df772c (patch) | |
tree | 0c38bf4c10cc99e5da5d47c2830efb3c8e81d2a5 /javax/swing/text/GlyphView.java | |
parent | d2f33039bd87de27b08ce88a7865d499b9b64c82 (diff) | |
download | classpath-32bb0e9c211961fbade190535b8041ece5df772c.tar.gz |
2006-08-12 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge of HEAD --> generics-branch for release
0.92 to 2006/08/12.
Diffstat (limited to 'javax/swing/text/GlyphView.java')
-rw-r--r-- | javax/swing/text/GlyphView.java | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/javax/swing/text/GlyphView.java b/javax/swing/text/GlyphView.java index d505274c9..65025dd08 100644 --- a/javax/swing/text/GlyphView.java +++ b/javax/swing/text/GlyphView.java @@ -39,6 +39,7 @@ exception statement from your version. */ package javax.swing.text; import java.awt.Color; +import java.awt.Container; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; @@ -354,11 +355,14 @@ public class GlyphView extends View implements TabableView, Cloneable Font font = view.getFont(); FontMetrics fm = view.getContainer().getFontMetrics(font); Segment txt = view.getText(el.getStartOffset(), pos); - int width = fm.charsWidth(txt.array, txt.offset, txt.count); + Rectangle bounds = a instanceof Rectangle ? (Rectangle) a + : a.getBounds(); + TabExpander expander = view.getTabExpander(); + int width = Utilities.getTabbedTextWidth(txt, fm, bounds.x, expander, + view.getStartOffset()); int height = fm.getHeight(); - Rectangle bounds = a.getBounds(); Rectangle result = new Rectangle(bounds.x + width, bounds.y, - bounds.x + width, height); + 0, height); return result; } @@ -536,9 +540,24 @@ public class GlyphView extends View implements TabableView, Cloneable */ public void paint(Graphics g, Shape a) { - Element el = getElement(); checkPainter(); - getGlyphPainter().paint(this, g, a, getStartOffset(), getEndOffset()); + int p0 = getStartOffset(); + int p1 = getEndOffset(); + + Container c = getContainer(); + // Paint layered highlights if there are any. + if (c instanceof JTextComponent) + { + JTextComponent tc = (JTextComponent) c; + Highlighter h = tc.getHighlighter(); + if (h instanceof LayeredHighlighter) + { + LayeredHighlighter lh = (LayeredHighlighter) h; + lh.paintLayeredHighlights(g, p0, p1, a, tc, this); + } + } + + getGlyphPainter().paint(this, g, a, p0, p1); } |