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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user