From c6fc26256a23cdb6d588e56d3973122555cd193c Mon Sep 17 00:00:00 2001 From: mdb Date: Sat, 15 Nov 2003 03:06:38 +0000 Subject: [PATCH] When our text is changed, if we're in "find out how much space we have then relayout" mode, we need to clear a few things out so that we don't end up reusing layout information from our previous text. Also added code to use our foreground color when rendering rather than whatever the graphics context happens to have set. This may cause funny business in places, but it's better to fix this now than to continue to rely on this arbitrary behavior. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1311 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../src/java/com/samskivert/swing/MultiLineLabel.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/samskivert/src/java/com/samskivert/swing/MultiLineLabel.java b/projects/samskivert/src/java/com/samskivert/swing/MultiLineLabel.java index fae9c510..73d52401 100644 --- a/projects/samskivert/src/java/com/samskivert/swing/MultiLineLabel.java +++ b/projects/samskivert/src/java/com/samskivert/swing/MultiLineLabel.java @@ -1,5 +1,5 @@ // -// $Id: MultiLineLabel.java,v 1.12 2003/04/04 21:29:54 mdb Exp $ +// $Id: MultiLineLabel.java,v 1.13 2003/11/15 03:06:38 mdb Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2002 Walter Korman @@ -161,6 +161,11 @@ public class MultiLineLabel extends JComponent { if (_label.setText(text)) { _dirty = true; + // clear out our constrained size where appropriate + if (_constrain == HORIZONTAL || _constrain == VERTICAL) { + _constrainedSize = 0; + _label.clearTargetDimens(); + } revalidate(); repaint(); } @@ -230,6 +235,9 @@ public class MultiLineLabel extends JComponent int wid = getWidth(), hei = getHeight(); Dimension ld = _label.getSize(); + // set the text color to our foreground color + _label.setTextColor(getForeground()); + // calculate the x-offset at which the label is rendered switch (align) { case CENTER: dx = (wid - ld.width) / 2; break;