public class RMTextEditor
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
RMTextEditor.Listener
Listener class so other objects can track changes to text editor.
|
Modifier and Type | Field and Description |
---|---|
static boolean |
isHyphenating |
static boolean |
isSpellChecking |
Constructor and Description |
---|
RMTextEditor()
Creates a plain text editor.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(RMTextEditor.Listener aTEL)
Adds a listener.
|
void |
copy()
Copies the current selection onto the clipboard.
|
void |
cut()
Copies the current selection onto the clip board, then deletes the current selection.
|
void |
delete()
Deletes the current selection.
|
void |
deleteForward()
Deletes the character in front of the insertion point.
|
void |
deleteToLineEnd()
Deletes the characters from the insertion point to the end of the line.
|
byte |
getAlign()
Returns the alignment for current selection.
|
RMRect |
getBounds()
Returns the bounds of the text editor.
|
float |
getCharSpacing()
Returns the character spacing of the current selection or cursor.
|
RMColor |
getColor()
Returns the color of the current selection or cursor.
|
RMFont |
getFont()
Returns the font of the current selection or cursor.
|
float |
getFontScale()
Returns the scale applied to text when editing.
|
RMFormat |
getFormat()
Returns the format of the current selection or cursor.
|
float |
getHeightToFit()
Returns the height needed to display all characters.
|
java.util.Map |
getInputAttributes()
Returns the map of attributes applied to any inputted characters.
|
RMParagraph |
getInputParagraph()
Returns the paragraph of the current selection or cursor position.
|
float |
getLineGap()
Returns the line gap for current selection.
|
float |
getLineHeightMax()
Returns the maximum line height for a line of text (even if font size would dictate higher).
|
float |
getLineHeightMin()
Returns the min line height for current selection.
|
float |
getLineSpacing()
Returns the line spacing for current selection.
|
RMTextEditor.Listener |
getListener(int anIndex)
Return the listener at the given index.
|
RMXString.Outline |
getOutline()
Returns whether current selection is outlined.
|
static java.awt.geom.GeneralPath |
getSelectionPath(RMTextEditor aTextEditor,
RMTextLayout aTextLayout)
Returns a path for the current selection.
|
int |
getSelEnd()
Returns the character index of the end of the text selection.
|
int |
getSelStart()
Returns the character index of the start of the text selection.
|
static java.awt.geom.GeneralPath |
getSpellingPath(RMTextEditor aTextEditor,
RMTextLayout aTextLayout)
Returns a path for misspelled word underlining.
|
java.lang.String |
getString()
Returns the plain string of the xstring being edited.
|
RMTextLayout |
getTextLayout()
Returns the configured text layout used to layout text.
|
RMXString |
getXString()
Returns the xstring that is being edited.
|
boolean |
isUnderlined()
Returns whether current selection is underlined.
|
void |
keyBackward()
Moves the insertion point backward a character (or if a range is selected, moves to beginning of range).
|
void |
keyDown()
Moves the insertion point down a line, trying preserve distance from beginning of line.
|
void |
keyForward()
Moves the insertion point forward a character (or if a range is selected, moves to end of range).
|
void |
keyUp()
Moves the insertion point up a line, trying to preserve distance from beginning of line.
|
int |
length()
Returns the number of characters in the text string.
|
void |
lineEnd()
Moves the insertion point to the end of line.
|
void |
lineStart()
Moves the insertion point to the beginning of line.
|
void |
mouseDragged(java.awt.event.MouseEvent e,
RMPoint location)
Handles mouse dragged.
|
void |
mousePressed(java.awt.event.MouseEvent e,
RMPoint location)
Handles mouse pressed.
|
void |
mouseReleased(java.awt.event.MouseEvent e,
RMPoint location)
Handles mouse released.
|
void |
paintLayout(java.awt.Graphics2D g,
float opacity)
Paints the text editor (with an opacity value).
|
static void |
paintLayout(RMTextEditor aTextEditor,
RMTextLayout aTextLayout,
java.awt.Graphics2D g,
float opacity)
Paints a given layout in a given graphics.
|
void |
paste()
Pasts the current clipboard data over the current selection.
|
void |
processKeyEvent(java.awt.event.KeyEvent e)
Handles key events.
|
void |
removeListener(RMTextEditor.Listener aTEL)
Removes a listener.
|
void |
replace(RMXString aString)
Replaces the current selection with the given xstring.
|
void |
replace(java.lang.String aString)
Replaces the current selection with the given string.
|
void |
selectAll()
Selects all the characters in the text editor.
|
void |
setAlign(int align)
Sets the alignment for current selection.
|
void |
setBounds(float x,
float y,
float w,
float h)
Set the bounds of the text editor.
|
void |
setCharSpacing(float aValue)
Returns the character spacing of the current selection or cursor.
|
void |
setColor(RMColor color)
Sets the color of the current selection or cursor.
|
void |
setFont(RMFont font)
Sets the font of the current selection or cursor.
|
void |
setFontScale(float aScale)
Sets the scale applied to text when editing.
|
void |
setFormat(RMFormat aFormat)
Sets the format of the current selection or cursor, after trying to expand the selection to encompase currently
selected, @-sign deliniated key.
|
void |
setInputAttribute(java.lang.String aKey,
java.lang.Object aValue)
Sets the attributes that are applied to current selection or newly typed chars.
|
void |
setInputParagraph(RMParagraph ps)
Sets the paragraph of the current selection or cursor position.
|
void |
setLineGap(float aHeight)
Sets the line gap for current selection.
|
void |
setLineHeightMax(float aHeight)
Sets the maximum line height for a line of text (even if font size would dictate higher).
|
void |
setLineHeightMin(float aHeight)
Sets the min line height for current selection.
|
void |
setLineSpacing(float aHeight)
Sets the line spacing for current selection.
|
void |
setNeedsRepaint()
Tell the text editor listener that editor needs repaint.
|
void |
setOutline(RMXString.Outline anOutline)
Sets whether current selection is outlined.
|
void |
setSelection(int newStartEnd)
Sets the character index of the text cursor.
|
void |
setSelection(int newStart,
int newEnd)
Sets the character index of the start and end of the text selection.
|
void |
setSelEnd(int newEnd)
Sets the character index of the end of the text selection.
|
void |
setSelStart(int newStart)
Sets the character index of the start of the text selection.
|
void |
setSubscript()
Sets current selection to subscript.
|
void |
setSuperscript()
Sets current selection to superscript.
|
void |
setTextLayout(RMTextLayout aLayout)
Sets the text layout for this text editor.
|
void |
setUnderlined(boolean aFlag)
Sets whether current selection is underlined.
|
void |
setXString(RMXString aString)
Sets the xstring that is to be edited.
|
RMRange |
smartFindFormatRange()
This method returns the range of the @-sign delinated key closest to the current selection (or null if not found).
|
void |
textDidChange()
Called when characters where added, updated or deleted.
|
public static boolean isSpellChecking
public static boolean isHyphenating
public RMXString getXString()
public void setXString(RMXString aString)
public RMRect getBounds()
public void setBounds(float x, float y, float w, float h)
public int length()
public int getSelStart()
public void setSelStart(int newStart)
public int getSelEnd()
public void setSelEnd(int newEnd)
public void setSelection(int newStartEnd)
public void setSelection(int newStart, int newEnd)
public float getFontScale()
public void setFontScale(float aScale)
public RMTextLayout getTextLayout()
public void setTextLayout(RMTextLayout aLayout)
public java.util.Map getInputAttributes()
public void setInputAttribute(java.lang.String aKey, java.lang.Object aValue)
public RMParagraph getInputParagraph()
public void setInputParagraph(RMParagraph ps)
public java.lang.String getString()
public RMColor getColor()
public void setColor(RMColor color)
public RMFont getFont()
public void setFont(RMFont font)
public RMFormat getFormat()
public void setFormat(RMFormat aFormat)
public RMRange smartFindFormatRange()
public boolean isUnderlined()
public void setUnderlined(boolean aFlag)
public RMXString.Outline getOutline()
public void setOutline(RMXString.Outline anOutline)
public void setSuperscript()
public void setSubscript()
public byte getAlign()
public void setAlign(int align)
public float getCharSpacing()
public void setCharSpacing(float aValue)
public float getLineSpacing()
public void setLineSpacing(float aHeight)
public float getLineGap()
public void setLineGap(float aHeight)
public float getLineHeightMin()
public void setLineHeightMin(float aHeight)
public float getLineHeightMax()
public void setLineHeightMax(float aHeight)
public RMTextEditor.Listener getListener(int anIndex)
public void addListener(RMTextEditor.Listener aTEL)
public void removeListener(RMTextEditor.Listener aTEL)
public void textDidChange()
public void setNeedsRepaint()
public void replace(java.lang.String aString)
public void replace(RMXString aString)
public void cut()
public void copy()
public void paste()
public void delete()
public void selectAll()
public void keyForward()
public void keyBackward()
public void keyUp()
public void keyDown()
public void lineStart()
public void lineEnd()
public void deleteForward()
public void deleteToLineEnd()
public float getHeightToFit()
public void processKeyEvent(java.awt.event.KeyEvent e)
public void mousePressed(java.awt.event.MouseEvent e, RMPoint location)
public void mouseDragged(java.awt.event.MouseEvent e, RMPoint location)
public void mouseReleased(java.awt.event.MouseEvent e, RMPoint location)
public void paintLayout(java.awt.Graphics2D g, float opacity)
public static void paintLayout(RMTextEditor aTextEditor, RMTextLayout aTextLayout, java.awt.Graphics2D g, float opacity)
public static java.awt.geom.GeneralPath getSelectionPath(RMTextEditor aTextEditor, RMTextLayout aTextLayout)
public static java.awt.geom.GeneralPath getSpellingPath(RMTextEditor aTextEditor, RMTextLayout aTextLayout)