From f5e8fdda6e1a3bb0c9a44a3196744955bfd587aa Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 1 Feb 2006 02:11:25 +0000 Subject: [PATCH] Allow subclasses to add attributes to the AttributedTextString. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1776 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- src/java/com/samskivert/swing/Label.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/java/com/samskivert/swing/Label.java b/src/java/com/samskivert/swing/Label.java index 23d5cf5b..823959ad 100644 --- a/src/java/com/samskivert/swing/Label.java +++ b/src/java/com/samskivert/swing/Label.java @@ -644,8 +644,17 @@ public class Label implements SwingConstants, LabelStyleConstants map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_ONE_PIXEL); } - AttributedString text = new AttributedString(_text, map); + AttributedString text = new AttributedString(_text, map); + addAttributes(text); + return text.getIterator(); + } + + /** + * Add any attributes to the text. + */ + protected void addAttributes (AttributedString text) + { // add any color attributes for specific segments if (_rawText != null) { Matcher m = COLOR_PATTERN.matcher(_rawText); @@ -685,8 +694,6 @@ public class Label implements SwingConstants, LabelStyleConstants startSeg, _text.length()); } } - - return text.getIterator(); } /**