Pulled layoutLabel() into a method so we can call it again if we want to

change our text.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3542 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2005-05-06 03:01:43 +00:00
parent 8dec58c227
commit 35c3458cd1
@@ -77,15 +77,7 @@ public class LabelSprite extends Sprite
// if our label is not yet laid out, do the deed
if (!_label.isLaidOut()) {
Graphics2D gfx = (Graphics2D)_mgr.getMediaPanel().getGraphics();
if (gfx != null) {
gfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
(_antiAliased) ?
RenderingHints.VALUE_ANTIALIAS_ON :
RenderingHints.VALUE_ANTIALIAS_OFF);
_label.layout(gfx);
gfx.dispose();
}
layoutLabel();
}
// size the bounds to fit our label
@@ -98,6 +90,23 @@ public class LabelSprite extends Sprite
_label.render(gfx, _bounds.x, _bounds.y);
}
/**
* Lays out our underlying label which must be done if the text is
* changed.
*/
protected void layoutLabel ()
{
Graphics2D gfx = (Graphics2D)_mgr.getMediaPanel().getGraphics();
if (gfx != null) {
gfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
(_antiAliased) ?
RenderingHints.VALUE_ANTIALIAS_ON :
RenderingHints.VALUE_ANTIALIAS_OFF);
_label.layout(gfx);
gfx.dispose();
}
}
/** The label associated with this sprite. */
protected Label _label;