public class TextCellFactory extends Object implements com.badlogic.gdx.utils.Disposable
Modifier and Type | Field and Description |
---|---|
protected float |
actualCellHeight |
protected float |
actualCellWidth |
protected com.badlogic.gdx.assets.AssetManager |
assetManager
The
AssetManager from where to load the font. |
protected com.badlogic.gdx.graphics.Texture |
block |
com.badlogic.gdx.graphics.g2d.BitmapFont |
bmpFont |
protected int |
bottomPadding |
static String |
DEFAULT_FITTING
The commonly used symbols in roguelike games.
|
protected float |
descent |
protected boolean |
distanceField |
protected float |
distanceFieldScaleX |
protected float |
distanceFieldScaleY |
protected String |
fitting |
protected int |
height |
protected int |
leftPadding |
static String |
LINE_FITTING
The commonly used symbols in roguelike games.
|
protected float |
lineHeight |
protected int |
rightPadding |
protected squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> |
scc |
protected com.badlogic.gdx.graphics.glutils.ShaderProgram |
shader |
protected float |
smoothingMultiplier |
static String |
SQUID_FITTING
The commonly used symbols in roguelike games.
|
protected LinkedHashMap<String,String> |
swap |
protected int |
topPadding |
protected int |
width |
Constructor and Description |
---|
TextCellFactory()
Creates a default valued factory.
|
TextCellFactory(com.badlogic.gdx.assets.AssetManager assetManager)
A default valued factory that uses the given
AssetManager to load
the font file. |
Modifier and Type | Method and Description |
---|---|
TextCellFactory |
addFit(String fit)
Adds the code points in the string to the list of characters that will be
guaranteed to fit.
|
TextCellFactory |
addSwap(char find,
char replace)
Adds a pair of chars as a replacement pair, so when the find char is requested to be drawn, the replace char is
used instead.
|
TextCellFactory |
addSwap(String find,
String replace)
Adds a pair of Strings (typically both with length 1) as a replacement pair, so when the find String is requested
to be drawn, the replace String is used instead.
|
TextCellFactory |
addSwaps(Map<String,String> swaps)
Appends to the mapping of replacement pairs, adding or replacing any entries in the current mapping with the
entries in a Map of String keys to String values.
|
boolean |
antialias()
Returns whether this factory is currently set to do antialiasing on the
characters rendered, which is always true.
|
TextCellFactory |
antialias(boolean antialias)
Deprecated.
AA is the wave of the future!
|
int |
bottomPadding()
Returns the padding on the bottom side.
|
TextCellFactory |
bottomPadding(int padding)
Sets the amount of padding on the bottom side to the provided value.
|
TextCellFactory |
clearSwaps()
Clears all replacement pairs this has been told to swap.
|
void |
configureShader(com.badlogic.gdx.graphics.g2d.Batch batch)
If using a distance field font, you MUST call this at some point while the batch has begun, or use code that
calls it for you (which is now much of SquidLib).
|
TextCellFactory |
copy() |
TextCellFactory |
defaultDistanceFieldFont()
Sets the TextCellFactory to use a square distance field font that will resize to whatever size you request.
|
TextCellFactory |
defaultFont()
Sets this factory to use a default 12x24 font that supports Latin, Greek, Cyrillic, and many more, including
box-drawing characters, zodiac signs, playing-card suits, and chess piece symbols.
|
TextCellFactory |
defaultNarrowDistanceFieldFont()
Sets the TextCellFactory to use a half-square distance field font that will resize to whatever size you request.
|
TextCellFactory |
defaultNarrowFont()
Sets this factory to use a default 12x24 font that renders very accurately, with no gaps between box-drawing
characters and very geometric lines.
|
TextCellFactory |
defaultSquareFont()
Sets this factory to use a default 12x12 font, which...
|
void |
dispose()
Releases all resources of this object.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
String s,
com.badlogic.gdx.graphics.Color color,
float x,
float y)
Use the specified Batch to draw a String (often just one char long) in the specified LibGDX Color, with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
String s,
float x,
float y)
Use the specified Batch to draw a String (often just one char long) with the default color (white), with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
String s,
float r,
float g,
float b,
float a,
float x,
float y)
Use the specified Batch to draw a String (often just one char long) in the specified rgba color, with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
com.badlogic.gdx.graphics.Color color,
float x,
float y)
Use the specified Batch to draw a TextureRegion tinted with the specified LibGDX Color, with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
com.badlogic.gdx.graphics.Color color,
float x,
float y,
float width,
float height)
Use the specified Batch to draw a TextureRegion tinted with the specified LibGDX Color, with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
float x,
float y)
Use the specified Batch to draw a TextureRegion with the default tint color (white, so un-tinted), with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
float x,
float y,
float width,
float height)
Use the specified Batch to draw a TextureRegion with the default tint color (white, so un-tinted), with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
float r,
float g,
float b,
float a,
float x,
float y)
Use the specified Batch to draw a TextureRegion tinted with the specified rgba color, with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
float r,
float g,
float b,
float a,
float x,
float y,
float width,
float height)
Use the specified Batch to draw a TextureRegion tinted with the specified rgba color, with x and y
determining the world-space coordinates for the upper-left corner.
|
String |
fit()
Returns the current String of code points that are used for sizing the
cells.
|
TextCellFactory |
fit(String fit)
Sets the characters that will be guaranteed to fit to the provided ones.
|
com.badlogic.gdx.graphics.g2d.BitmapFont |
font()
Returns the font used by this factory.
|
TextCellFactory |
font(com.badlogic.gdx.graphics.g2d.BitmapFont bitmapFont)
Sets this factory to use the provided BitmapFont as its font without re-constructing anything.
|
TextCellFactory |
font(String fontpath)
Sets this factory to use the provided font.
|
TextCellFactory |
fontDistanceField(String fontPath,
String texturePath)
Sets the font to a distance field font with the given String path to a .fnt file and String path to a texture.
|
LinkedHashMap<String,String> |
getAllSwaps()
Gets the current mapping of "swaps", or replacement pairs, to replace keys requested for drawing with their
values in the LinkedHashMap.
|
float |
getDescent()
Gets the descent of this TextCellFactory's BitmapFont, which may be useful for layout outside this class.
|
float |
getDistanceFieldScaleX() |
float |
getDistanceFieldScaleY() |
float |
getSmoothingMultiplier()
If this uses a distance field font, the smoothing multiplier affects how crisp or blurry lines are, with higher
numbers generally resulting in more crisp fonts, but numbers that are too high cause jagged aliasing.
|
com.badlogic.gdx.graphics.Texture |
getSolid()
Returns a solid block of white, 1x1 pixel in size; can be drawn at other sizes by Batch.
|
int |
height()
Returns the height of a single cell.
|
TextCellFactory |
height(int height)
Sets the factory's cell height to the provided value.
|
TextCellFactory |
initByFont()
Initializes the factory to then be able to create text cells on demand.
|
TextCellFactory |
initBySize()
Initializes the factory to then be able to create text cells on demand.
|
boolean |
initialized()
Returns true if this factory is fully initialized and ready to build text cells.
|
TextCellFactory |
initVerbatim()
Initializes the factory to then be able to create text cells on demand.
|
boolean |
isDistanceField() |
int |
leftPadding()
Returns the padding on the left side.
|
TextCellFactory |
leftPadding(int padding)
Sets the amount of padding on the left side to the provided value.
|
com.badlogic.gdx.scenes.scene2d.Actor |
makeActor(String s,
Collection<com.badlogic.gdx.graphics.Color> colors)
Converts a String into a ColorChangeLabel, or if the argument s is null, creates a ColorChangeImage of a solid
block.
|
com.badlogic.gdx.scenes.scene2d.Actor |
makeActor(String s,
Collection<com.badlogic.gdx.graphics.Color> colors,
float loopTime)
Converts a String into a ColorChangeLabel, or if the argument s is null, creates a ColorChangeImage of a solid
block.
|
com.badlogic.gdx.scenes.scene2d.Actor |
makeActor(String s,
com.badlogic.gdx.graphics.Color color)
Converts a String into a Label, or if the argument s is null, creates an Image of a solid block.
|
com.badlogic.gdx.scenes.scene2d.Actor |
makeActor(com.badlogic.gdx.graphics.g2d.TextureRegion tr,
com.badlogic.gdx.graphics.Color color)
Converts a TextureRegion into an Image, or if the argument s is null, creates an Image of a solid block.
|
com.badlogic.gdx.scenes.scene2d.Actor |
makeActor(com.badlogic.gdx.graphics.g2d.TextureRegion tr,
com.badlogic.gdx.graphics.Color color,
float width,
float height)
Converts a TextureRegion into an Image, or if the argument s is null, creates an Image of a solid block.
|
com.badlogic.gdx.scenes.scene2d.ui.Label |
makeWrappingString(String s)
Converts a String into a Label, or if the argument s is null, creates an Image of a solid block.
|
TextCellFactory |
padding(int padding)
Sets the amount of padding on all sides to the provided value.
|
TextCellFactory |
removeSwap(char find)
Removes the replacement pair, if present, that searches for the given key, find.
|
TextCellFactory |
removeSwap(String find)
Removes the replacement pair, if present, that searches for the given key, find.
|
int |
rightPadding()
Returns the padding on the right side.
|
TextCellFactory |
rightPadding(int padding)
Sets the amount of padding on the right side to the provided value.
|
TextCellFactory |
setAllSwaps(Map<String,String> swaps)
Sets the mapping of replacement pairs to a different one as a Map of String keys to String values.
|
TextCellFactory |
setColorCenter(squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> icc) |
TextCellFactory |
setSmoothingMultiplier(float smoothingMultiplier)
If this uses a distance field font, the smoothing multiplier affects how crisp or blurry lines are, with higher
numbers generally resulting in more crisp fonts, but numbers that are too high cause jagged aliasing.
|
int |
topPadding()
Returns the padding on the top side.
|
TextCellFactory |
topPadding(int padding)
Sets the amount of padding on the top side to the provided value.
|
TextCellFactory |
tweakHeight(int height)
Sets the factory's height used for text to the provided value, but does not change the size of a cell.
|
TextCellFactory |
tweakWidth(int width)
Sets the factory's height used for text to the provided value, but does not change the size of a cell.
|
int |
width()
Returns the width of a single cell.
|
TextCellFactory |
width(int width)
Sets the factory's cell width to the provided value.
|
boolean |
willFit(int codepoint)
Returns true if the given character will fit inside the current cell
dimensions with the current font.
|
public static final String DEFAULT_FITTING
public static final String LINE_FITTING
public static final String SQUID_FITTING
protected com.badlogic.gdx.assets.AssetManager assetManager
AssetManager
from where to load the font. Use it to share
loading of a font's file across multiple factories.public com.badlogic.gdx.graphics.g2d.BitmapFont bmpFont
protected com.badlogic.gdx.graphics.Texture block
protected squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> scc
protected int leftPadding
protected int rightPadding
protected int topPadding
protected int bottomPadding
protected int width
protected int height
protected float actualCellWidth
protected float actualCellHeight
protected float distanceFieldScaleX
protected float distanceFieldScaleY
protected boolean distanceField
protected com.badlogic.gdx.graphics.glutils.ShaderProgram shader
protected float smoothingMultiplier
protected float descent
protected float lineHeight
protected LinkedHashMap<String,String> swap
public TextCellFactory()
public TextCellFactory(com.badlogic.gdx.assets.AssetManager assetManager)
AssetManager
to load
the font file. Use this constructor if you are likely to load the same
font over and over (recall that, without an AssetManager
, each
instance of TextCellFactory
will load its font from disk). This
primarily matters if you are using fonts not bundled with SquidLib, since
accessing a BitmapFont with a method (not a String) from DefaultResources
caches the BitmapFont already.assetManager
- an ordinary libGDX AssetManagerpublic TextCellFactory copy()
public TextCellFactory initByFont()
public TextCellFactory initBySize()
public TextCellFactory initVerbatim()
public com.badlogic.gdx.graphics.g2d.BitmapFont font()
public TextCellFactory font(String fontpath)
fontpath
- the path to the font to usepublic TextCellFactory font(com.badlogic.gdx.graphics.g2d.BitmapFont bitmapFont)
DefaultResources.getDefaultFont()
or any other variable
with BitmapFont as its type. The bitmap font will not be loaded from file with this method, which it would be if
you called the overload of font() that takes a String more than once. These BitmapFont resources are already
bundled with SquidLib:
bitmapFont
- the BitmapFont this should usepublic TextCellFactory fontDistanceField(String fontPath, String texturePath)
fontPath
- the path to a .fnt bitmap font file with distance field effects applied, which requires a complex
process to create.texturePath
- the path to the texture used by the bitmap fontpublic TextCellFactory defaultFont()
public TextCellFactory defaultNarrowFont()
public TextCellFactory defaultSquareFont()
public TextCellFactory defaultDistanceFieldFont()
public TextCellFactory defaultNarrowDistanceFieldFont()
public int width()
public TextCellFactory width(int width)
width
- the desired widthpublic int height()
public TextCellFactory height(int height)
height
- the desired widthpublic TextCellFactory tweakWidth(int width)
width
- the desired widthpublic TextCellFactory tweakHeight(int height)
height
- the desired heightpublic String fit()
public TextCellFactory fit(String fit)
fit
- the String of code points to size topublic TextCellFactory addFit(String fit)
fit
- the String of code points to size topublic boolean antialias()
public TextCellFactory antialias(boolean antialias)
antialias
- ignored, will always use antialiasingpublic TextCellFactory padding(int padding)
padding
- how much padding in pixelspublic int leftPadding()
public TextCellFactory leftPadding(int padding)
padding
- how much padding in pixelspublic int rightPadding()
public TextCellFactory rightPadding(int padding)
padding
- how much padding in pixelspublic int topPadding()
public TextCellFactory topPadding(int padding)
padding
- how much padding in pixelspublic int bottomPadding()
public TextCellFactory bottomPadding(int padding)
padding
- how much padding in pixelspublic TextCellFactory setColorCenter(squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> icc)
icc
- The color center to use. Should not be null
.this
NullPointerException
- If icc
is null
.public boolean initialized()
public boolean willFit(int codepoint)
codepoint
- public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, String s, float x, float y)
batch
- the LibGDX Batch to do the drawings
- the string to draw, often but not necessarily one char. Can be null to draw a solid block instead.x
- x of the upper-left corner of the region of text in world coordinates.y
- y of the upper-left corner of the region of text in world coordinates.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, String s, float r, float g, float b, float a, float x, float y)
batch
- the LibGDX Batch to do the drawings
- the string to draw, often but not necessarily one char. Can be null to draw a solid block instead.r
- 0.0 to 0.1 red valueg
- 0.0 to 0.1 green valueb
- 0.0 to 0.1 blue valuea
- 0.0 to 0.1 alpha valuex
- x of the upper-left corner of the region of text in world coordinates.y
- y of the upper-left corner of the region of text in world coordinates.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, String s, com.badlogic.gdx.graphics.Color color, float x, float y)
batch
- the LibGDX Batch to do the drawings
- the string to draw, often but not necessarily one char. Can be null to draw a solid block instead.color
- the LibGDX Color to draw the char(s) with, all the same colorx
- x of the upper-left corner of the region of text in world coordinates.y
- y of the upper-left corner of the region of text in world coordinates.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion tr, float x, float y)
batch
- the LibGDX Batch to do the drawingtr
- the TextureRegion to draw. Can be null to draw a solid block instead.x
- x of the upper-left corner of the region of text in world coordinates.y
- y of the upper-left corner of the region of text in world coordinates.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion tr, float r, float g, float b, float a, float x, float y)
batch
- the LibGDX Batch to do the drawingtr
- the TextureRegion to draw. Can be null to draw a solid block instead.r
- 0.0 to 0.1 red valueg
- 0.0 to 0.1 green valueb
- 0.0 to 0.1 blue valuea
- 0.0 to 0.1 alpha valuex
- x of the upper-left corner of the region of text in world coordinates.y
- y of the upper-left corner of the region of text in world coordinates.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion tr, com.badlogic.gdx.graphics.Color color, float x, float y)
batch
- the LibGDX Batch to do the drawingtr
- the TextureRegion to draw. Can be null to draw a solid block instead.color
- the LibGDX Color to draw the char(s) with, all the same colorx
- x of the upper-left corner of the region of text in world coordinates.y
- y of the upper-left corner of the region of text in world coordinates.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion tr, float x, float y, float width, float height)
batch
- the LibGDX Batch to do the drawingtr
- the TextureRegion to draw. Can be null to draw a solid block instead.x
- x of the upper-left corner of the region of text in world coordinates.y
- y of the upper-left corner of the region of text in world coordinates.width
- the width of the TextureRegion or solid block in pixels.height
- the height of the TextureRegion or solid block in pixels.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion tr, float r, float g, float b, float a, float x, float y, float width, float height)
batch
- the LibGDX Batch to do the drawingtr
- the TextureRegion to draw. Can be null to draw a solid block instead.r
- 0.0 to 0.1 red valueg
- 0.0 to 0.1 green valueb
- 0.0 to 0.1 blue valuea
- 0.0 to 0.1 alpha valuex
- x of the upper-left corner of the region of text in world coordinates.y
- y of the upper-left corner of the region of text in world coordinates.width
- the width of the TextureRegion or solid block in pixels.height
- the height of the TextureRegion or solid block in pixels.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion tr, com.badlogic.gdx.graphics.Color color, float x, float y, float width, float height)
batch
- the LibGDX Batch to do the drawingtr
- the TextureRegion to draw. Can be null to draw a solid block instead.color
- the LibGDX Color to draw the char(s) with, all the same colorx
- x of the upper-left corner of the region of text in world coordinates.y
- y of the upper-left corner of the region of text in world coordinates.width
- the width of the TextureRegion or solid block in pixels.height
- the height of the TextureRegion or solid block in pixels.public com.badlogic.gdx.scenes.scene2d.ui.Label makeWrappingString(String s)
s
- a String to make into an Actor, which can be null for a solid block.public com.badlogic.gdx.scenes.scene2d.Actor makeActor(String s, com.badlogic.gdx.graphics.Color color)
s
- a String to make into an Actor, which can be null for a solid block.color
- a Color to tint s with.public com.badlogic.gdx.scenes.scene2d.Actor makeActor(String s, Collection<com.badlogic.gdx.graphics.Color> colors)
s
- a String to make into an Actor, which can be null for a solid block.colors
- a List of Color to tint s with, looping through all elements in the list each secondpublic com.badlogic.gdx.scenes.scene2d.Actor makeActor(String s, Collection<com.badlogic.gdx.graphics.Color> colors, float loopTime)
s
- a String to make into an Actor, which can be null for a solid block.colors
- a List of Color to tint s with, looping through all elements in the list each secondloopTime
- the amount of time, in seconds, to spend looping through all colors in the listpublic com.badlogic.gdx.scenes.scene2d.Actor makeActor(com.badlogic.gdx.graphics.g2d.TextureRegion tr, com.badlogic.gdx.graphics.Color color)
tr
- a TextureRegion to make into an Actor, which can be null for a solid block.color
- a Color to tint tr with.public com.badlogic.gdx.scenes.scene2d.Actor makeActor(com.badlogic.gdx.graphics.g2d.TextureRegion tr, com.badlogic.gdx.graphics.Color color, float width, float height)
tr
- a TextureRegion to make into an Actor, which can be null for a solid block.color
- a Color to tint tr with.public com.badlogic.gdx.graphics.Texture getSolid()
public boolean isDistanceField()
public float getDistanceFieldScaleX()
public float getDistanceFieldScaleY()
public float getSmoothingMultiplier()
public TextCellFactory setSmoothingMultiplier(float smoothingMultiplier)
smoothingMultiplier
- the new value for the smoothing multiplier as a float; should be fairly close to 1f.public void configureShader(com.badlogic.gdx.graphics.g2d.Batch batch)
batch
- the Batch, such as a SpriteBatch, to configure to render distance field fonts if necessary.public void dispose()
dispose
in interface com.badlogic.gdx.utils.Disposable
public float getDescent()
public TextCellFactory addSwap(String find, String replace)
addSwap("^", ",")
and also
addSwap(",", ":")
, then a requested '^' will be drawn as ',', not ':', but a requested ',' will be drawn
as ':' (only one swap will be performed). Typically you want a different TextCellFactory for UI elements that use
swapping, like a top-down char-based map, and elements that should not, like those that display normal text.find
- the requested String that will be changedreplace
- the replacement String that will be used in place of findpublic TextCellFactory addSwap(char find, char replace)
addSwap('^', ',')
and also
addSwap(',', ':')
, then a requested '^' will be drawn as ',', not ':', but a requested ',' will be drawn
as ':' (only one swap will be performed). Typically you want a different TextCellFactory for UI elements that use
swapping, like a top-down char-based map, and elements that should not, like those that display normal text.find
- the requested char that will be changed (converted to a length-1 String)replace
- the replacement char that will be used in place of find (converted to a length-1 String)public TextCellFactory removeSwap(String find)
addSwap("^", ",")
and also
addSwap(",", ":")
, then a requested '^' will be drawn as ',', not ':', but a requested ',' will be drawn
as ':' (only one swap will be performed). Typically you want a different TextCellFactory for UI elements that use
swapping, like a top-down char-based map, and elements that should not, like those that display normal text.find
- the String that would be changed in the replacement pairpublic TextCellFactory removeSwap(char find)
addSwap('^', ',')
and also
addSwap(',', ':')
, then a requested '^' will be drawn as ',', not ':', but a requested ',' will be drawn
as ':' (only one swap will be performed). Typically you want a different TextCellFactory for UI elements that use
swapping, like a top-down char-based map, and elements that should not, like those that display normal text.public LinkedHashMap<String,String> getAllSwaps()
addSwap("^", ",")
and also
addSwap(",", ":")
, then a requested '^' will be drawn as ',', not ':', but a requested ',' will be drawn
as ':' (only one swap will be performed). Typically you want a different TextCellFactory for UI elements that use
swapping, like a top-down char-based map, and elements that should not, like those that display normal text.public TextCellFactory setAllSwaps(Map<String,String> swaps)
addSwap("^", ",")
and also
addSwap(",", ":")
, then a requested '^' will be drawn as ',', not ':', but a requested ',' will be drawn
as ':' (only one swap will be performed). Typically you want a different TextCellFactory for UI elements that use
swapping, like a top-down char-based map, and elements that should not, like those that display normal text.swaps
- the Map of replacement pairs; keys requested for drawing will be replaced with their valuespublic TextCellFactory addSwaps(Map<String,String> swaps)
addSwap("^", ",")
and also
addSwap(",", ":")
, then a requested '^' will be drawn as ',', not ':', but a requested ',' will be drawn
as ':' (only one swap will be performed). Typically you want a different TextCellFactory for UI elements that use
swapping, like a top-down char-based map, and elements that should not, like those that display normal text.swaps
- the Map of replacement pairs to add; keys requested for drawing will be replaced with their valuespublic TextCellFactory clearSwaps()
addSwap("^", ",")
and also
addSwap(",", ":")
, then a requested '^' will be drawn as ',', not ':', but a requested ',' will be drawn
as ':' (only one swap will be performed). Typically you want a different TextCellFactory for UI elements that use
swapping, like a top-down char-based map, and elements that should not, like those that display normal text.Copyright © 2012–2016. All rights reserved.