public class TextCutter
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.awt.FontMetrics |
fontMetrics
Measure strings
|
private int |
width
Width limit
|
Constructor and Description |
---|
TextCutter(int width,
java.awt.Font font)
Create a new instance of TextCutter
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
convert(java.lang.String string)
Convert a string to a cut one using current settings
|
int |
getWidth()
Maximum width in pixels
|
void |
setFont(java.awt.Font font)
Change current font
|
void |
setWidth(int width)
Change maximum width
|
private java.awt.FontMetrics fontMetrics
private int width
public TextCutter(int width, java.awt.Font font)
width
- Width limit in pixelsfont
- Font to usepublic java.lang.String convert(java.lang.String string)
string
- String to cutpublic int getWidth()
public void setFont(java.awt.Font font)
font
- New fontpublic void setWidth(int width)
width
- new maximum width in pixels