Our host need not be a MediaPanel, but we'll preserve the MediaPanel signature
because no doubt much code exists in the wild that is compiled against that signature. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@154 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
package com.threerings.parlor.media;
|
package com.threerings.parlor.media;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
|
||||||
import com.samskivert.swing.Label;
|
import com.samskivert.swing.Label;
|
||||||
@@ -36,8 +37,7 @@ public class ScoreAnimation extends FloatingTextAnimation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a score animation for the given score value centered at
|
* Constructs a score animation for the given score value centered at the given coordinates.
|
||||||
* the given coordinates.
|
|
||||||
*/
|
*/
|
||||||
public ScoreAnimation (Label label, int x, int y)
|
public ScoreAnimation (Label label, int x, int y)
|
||||||
{
|
{
|
||||||
@@ -45,9 +45,8 @@ public class ScoreAnimation extends FloatingTextAnimation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a score animation for the given score value centered at
|
* Constructs a score animation for the given score value centered at the given
|
||||||
* the given coordinates. The animation will float up the screen for
|
* coordinates. The animation will float up the screen for 30 pixels.
|
||||||
* 30 pixels.
|
|
||||||
*/
|
*/
|
||||||
public ScoreAnimation (Label label, int x, int y, long floatPeriod)
|
public ScoreAnimation (Label label, int x, int y, long floatPeriod)
|
||||||
{
|
{
|
||||||
@@ -55,22 +54,26 @@ public class ScoreAnimation extends FloatingTextAnimation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a score animation for the given score value starting at
|
* Constructs a score animation for the given score value starting at the given coordinates and
|
||||||
* the given coordinates and floating toward the specified
|
* floating toward the specified coordinates.
|
||||||
* coordinates.
|
|
||||||
*/
|
*/
|
||||||
public ScoreAnimation (Label label, int sx, int sy,
|
public ScoreAnimation (Label label, int sx, int sy, int destx, int desty, long floatPeriod)
|
||||||
int destx, int desty, long floatPeriod)
|
|
||||||
{
|
{
|
||||||
super(label, sx, sy, destx, desty, floatPeriod);
|
super(label, sx, sy, destx, desty, floatPeriod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and configure a Label suitable for a ScoreAnimation with
|
* Create and configure a Label suitable for a ScoreAnimation with all the most common options.
|
||||||
* all the most common options.
|
|
||||||
*/
|
*/
|
||||||
public static Label createLabel (String score, Color c, Font font,
|
public static Label createLabel (String score, Color c, Font font, MediaPanel host)
|
||||||
MediaPanel host)
|
{
|
||||||
|
return createLabel(score, c, font, host);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and configure a Label suitable for a ScoreAnimation with all the most common options.
|
||||||
|
*/
|
||||||
|
public static Label createLabel (String score, Color c, Font font, Component host)
|
||||||
{
|
{
|
||||||
Label label = new Label(score);
|
Label label = new Label(score);
|
||||||
label.setTargetWidth(host.getWidth());
|
label.setTargetWidth(host.getWidth());
|
||||||
@@ -80,7 +83,6 @@ public class ScoreAnimation extends FloatingTextAnimation
|
|||||||
label.setFont(font);
|
label.setFont(font);
|
||||||
label.setAlignment(Label.CENTER);
|
label.setAlignment(Label.CENTER);
|
||||||
label.layout(host);
|
label.layout(host);
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user