Added updateBounds method to LabelSprite to allow changing the label, added methods to TrickCardGameUtil to get players left/right/opposite, changed the way CardPanel handles selections.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3481 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Andrzej Kapolka
2005-04-13 21:09:32 +00:00
parent 4c3dd9b1af
commit 86959a5191
3 changed files with 64 additions and 38 deletions
@@ -30,8 +30,8 @@ import com.samskivert.swing.Label;
/**
* A sprite that uses a label to render itself. If the label has not been
* previously laid out (see {@link Label#layout}) it will be done when the
* sprite is added to a media panel. The label should not be altered
* after the sprite is created.
* sprite is added to a media panel. If the label is altered after the
* sprite is created, {@link #updateBounds} should be called.
*/
public class LabelSprite extends Sprite
{
@@ -60,6 +60,16 @@ public class LabelSprite extends Sprite
_antiAliased = antiAliased;
}
/**
* Updates the bounds of the sprite after a change to the label.
*/
public void updateBounds ()
{
Dimension size = _label.getSize();
_bounds.width = size.width;
_bounds.height = size.height;
}
// documentation inherited
protected void init ()
{
@@ -79,9 +89,7 @@ public class LabelSprite extends Sprite
}
// size the bounds to fit our label
Dimension size = _label.getSize();
_bounds.width = size.width;
_bounds.height = size.height;
updateBounds();
}
// documentation inherited