Package VASSAL.counters
Class Labeler
java.lang.Object
VASSAL.counters.Decorator
VASSAL.counters.Labeler
- All Implemented Interfaces:
PropertyNameSource,PropertySource,EditablePiece,GamePiece,PropertyExporter,StateMergeable,TranslatablePiece,PersistentPropertyContainer,RecursionLimiter.Loopable
public class Labeler extends Decorator implements TranslatablePiece, RecursionLimiter.Loopable
Displays a text label, with content specified by the user at runtime.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classLabeler.HTMLLabelOpprotected static classLabeler.LabelOp -
Field Summary
Fields Modifier and Type Field Description static intBOTTOMDeprecated, for removal: This API element is subject to removal in a future version.static intCENTERDeprecated, for removal: This API element is subject to removal in a future version.protected Stringdescriptionstatic intHORIZONTAL_ALIGNMENTDeprecated, for removal: This API element is subject to removal in a future version.static StringIDprotected ScaledImagePainterimagePainterDeprecated.protected RectanglelastRectprotected ArealastShapestatic intLEFTDeprecated, for removal: This API element is subject to removal in a future version.protected KeyCommandmenuKeyCommandprotected StringpropertyNamestatic intRIGHTDeprecated, for removal: This API element is subject to removal in a future version.protected introtateDegreesprotected ColortextBgprotected ColortextFgstatic intTOPDeprecated, for removal: This API element is subject to removal in a future version.static intVERTICAL_ALIGNMENTDeprecated, for removal: This API element is subject to removal in a future version.Fields inherited from interface VASSAL.counters.PropertyExporter
LOCALIZED_NAMEFields inherited from interface VASSAL.i18n.TranslatablePiece
PREFIX -
Constructor Summary
-
Method Summary
Modifier and Type Method Description RectangleboundingBox()The area which this GamePiece occupies when drawn at the point (0,0)protected Stringclean(String s)voiddraw(Graphics g, int x, int y, Component obs, double zoom)Draw this GamePiecestatic voiddrawLabel(Graphics g, String text, int x, int y, int hAlign, int vAlign, Color fgColor, Color bgColor)Deprecated, for removal: This API element is subject to removal in a future version.static voiddrawLabel(Graphics g, String text, int x, int y, Font f, int hAlign, int vAlign, Color fgColor, Color bgColor, Color borderColor)Deprecated, for removal: This API element is subject to removal in a future version.StringgetComponentName()StringgetComponentTypeName()StringgetDescription()A plain-English description of this type of piecePieceEditorgetEditor()Get the configurer for this traitHelpFilegetHelpFile()PieceI18nDatagetI18nData()Return I18n data for this pieceStringgetLabel()StringgetLocalizedLabel()StringgetLocalizedName()Return the translated name for this piece.ObjectgetLocalizedProperty(Object key)StringgetName()The plain English name for this pieceObjectgetProperty(Object key)List<String>getPropertyNames()Return Property names exposed by this traitShapegetShape()Return the Shape of the counter by adding the shape of this label to the shape of all inner traits.KeyCommand[]myGetKeyCommands()StringmyGetState()StringmyGetType()CommandmyKeyEvent(KeyStroke stroke)The response of this trait alone to the given KeyStrokevoidmySetState(String s)Set just the state of this traitvoidmySetType(String type)Set the type information for this piece.voidsetBackground(Color textBg)voidsetForeground(Color textFg)voidsetLabel(String s)protected voidupdateCachedImage()Methods inherited from class VASSAL.counters.Decorator
getCommandDescription, getDecorator, getI18nData, getI18nData, getId, getInner, getInnermost, getKeyCommands, getMap, getOuter, getOutermost, getParent, getPersistentProperty, getPosition, getProperties, getState, getTranslation, getType, isSelected, keyEvent, mergeState, putOldProperties, repack, reportDataError, reportDataError, reportDataError, setId, setInner, setMap, setOldProperties, setOldProperties, setParent, setPersistentProperty, setPosition, setProperty, setSelected, setState, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface VASSAL.counters.GamePiece
getId, getMap, getParent, getPosition, getState, getType, keyEvent, setId, setMap, setParent, setPosition, setProperty, setStateMethods inherited from interface VASSAL.counters.PropertyExporter
getProperties
-
Field Details
-
ID
- See Also:
- Constant Field Values
-
textBg
-
textFg
-
CENTER
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
RIGHT
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
LEFT
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
TOP
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
BOTTOM
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
HORIZONTAL_ALIGNMENT
Deprecated, for removal: This API element is subject to removal in a future version. -
VERTICAL_ALIGNMENT
Deprecated, for removal: This API element is subject to removal in a future version. -
imagePainter
Deprecated. -
rotateDegrees
protected int rotateDegrees -
propertyName
-
description
-
lastRect
-
lastShape
-
-
Constructor Details
-
Labeler
public Labeler() -
Labeler
-
-
Method Details
-
mySetType
Description copied from interface:EditablePieceSet the type information for this piece. SeeDecorator.myGetType()- Specified by:
mySetTypein interfaceEditablePiece
-
clean
-
getLocalizedProperty
- Specified by:
getLocalizedPropertyin interfacePropertySource- Overrides:
getLocalizedPropertyin classDecorator
-
getProperty
- Specified by:
getPropertyin interfaceGamePiece- Specified by:
getPropertyin interfacePropertySource- Overrides:
getPropertyin classDecorator
-
myGetType
- Specified by:
myGetTypein classDecorator- Returns:
- the type of this trait alone
- See Also:
Decorator.getType()
-
myGetState
- Specified by:
myGetStatein classDecorator- Returns:
- the state of this trait alone
- See Also:
Decorator.getState()
-
mySetState
Description copied from class:DecoratorSet just the state of this trait- Specified by:
mySetStatein classDecorator- See Also:
Decorator.myGetState()
-
getName
Description copied from interface:GamePieceThe plain English name for this piece -
getLocalizedName
Description copied from class:DecoratorReturn the translated name for this piece. Most pieces do not have translatable elements, so just return the standard name- Specified by:
getLocalizedNamein interfaceGamePiece- Overrides:
getLocalizedNamein classDecorator
-
draw
Description copied from interface:GamePieceDraw this GamePiece -
updateCachedImage
protected void updateCachedImage() -
setLabel
-
setBackground
-
setForeground
-
getLabel
-
getLocalizedLabel
-
boundingBox
Description copied from interface:GamePieceThe area which this GamePiece occupies when drawn at the point (0,0)- Specified by:
boundingBoxin interfaceGamePiece
-
getShape
Return the Shape of the counter by adding the shape of this label to the shape of all inner traits. Minimize generation of new Area objects. -
myGetKeyCommands
- Specified by:
myGetKeyCommandsin classDecorator- Returns:
- the commands for this trait alone
- See Also:
Decorator.getKeyCommands()
-
myKeyEvent
Description copied from class:DecoratorThe response of this trait alone to the given KeyStroke- Specified by:
myKeyEventin classDecorator- Parameters:
stroke- Stroke to apply- Returns:
- Generated Command or null if no effect
- See Also:
Decorator.keyEvent(javax.swing.KeyStroke)
-
getDescription
Description copied from interface:EditablePieceA plain-English description of this type of piece- Specified by:
getDescriptionin interfaceEditablePiece
-
getHelpFile
- Specified by:
getHelpFilein interfaceEditablePiece
-
getEditor
Description copied from interface:EditablePieceGet the configurer for this trait- Specified by:
getEditorin interfaceEditablePiece- Overrides:
getEditorin classDecorator
-
getPropertyNames
Return Property names exposed by this trait- Specified by:
getPropertyNamesin interfacePropertyNameSource- Overrides:
getPropertyNamesin classDecorator
-
getI18nData
Description copied from class:DecoratorReturn I18n data for this piece- Specified by:
getI18nDatain interfaceTranslatablePiece- Overrides:
getI18nDatain classDecorator- Returns:
- I18n data
-
getComponentTypeName
- Specified by:
getComponentTypeNamein interfaceRecursionLimiter.Loopable
-
getComponentName
- Specified by:
getComponentNamein interfaceRecursionLimiter.Loopable
-
drawLabel
@Deprecated(since="2020-08-27", forRemoval=true) public static void drawLabel(Graphics g, String text, int x, int y, int hAlign, int vAlign, Color fgColor, Color bgColor)Deprecated, for removal: This API element is subject to removal in a future version. -
drawLabel
@Deprecated(since="2020-08-27", forRemoval=true) public static void drawLabel(Graphics g, String text, int x, int y, Font f, int hAlign, int vAlign, Color fgColor, Color bgColor, Color borderColor)Deprecated, for removal: This API element is subject to removal in a future version.
-
LabelUtils.drawLabel(Graphics, String, int, int, int, int, Color, Color)instead.