public static class MTextDocument.Section extends Object
Constructor and Description |
---|
MTextDocument.Section(int pos,
String s)
Constructs a text section.
|
MTextDocument.Section(int pos,
String s,
MTextAttributes attr)
Constructs a text section.
|
MTextDocument.Section(MTextDocument.Section sec)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
doubleStringWidth(String s,
MFont dmf,
FontMetrics fm,
Graphics g)
Gets the width of a string as a floating point number.
|
MTextAttributes |
getAttributes()
Gets the attributes.
|
FontMetrics |
getFontMetrics(Graphics g,
MFont deffnt)
Gets and updates the font metrics of a document section.
|
int |
getPosition()
Gets the position in the document.
|
String |
getString()
Gets the text string.
|
int |
length()
Gets text length.
|
String |
substring(int start)
Gets a substring.
|
String |
substring(int start,
int end)
Gets a substring.
|
public MTextDocument.Section(int pos, String s)
pos
- the position in the documents
- the text stringpublic MTextDocument.Section(int pos, String s, MTextAttributes attr)
pos
- the position in the documents
- the text stringattr
- text attributespublic MTextDocument.Section(MTextDocument.Section sec)
sec
- the section to copypublic int getPosition()
public String getString()
public String substring(int start)
start
- index of first characterpublic String substring(int start, int end)
start
- index of first characterend
- index of last character + 1public int length()
public MTextAttributes getAttributes()
public FontMetrics getFontMetrics(Graphics g, MFont deffnt)
g
- the graphics contextdeffnt
- the default fontpublic double doubleStringWidth(String s, MFont dmf, FontMetrics fm, Graphics g)
s
- the stringfm
- the font metricsg
- the graphics context