public class TextComponent extends ComponentBase
eventListenerList
Constructor and Description |
---|
TextComponent()
Initializes a new instance of the TextComponent class.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(java.awt.Graphics2D g2d,
RenderOptions options)
ComponentBase.draw override.
|
Brush |
getBackground()
Gets the brush used to fill the background of the component.
|
XDimension2D.Double |
getDesiredSize(XDimension2D.Double availableSize,
java.awt.Graphics2D g2d)
ComponentBase.getDesiredSize override.
|
java.awt.Font |
getFont()
Gets the font of the displayed text.
|
java.lang.String |
getText()
Gets the text displayed by the component.
|
java.awt.Color |
getTextColor()
Gets the color of the displayed text.
|
TextFormat |
getTextFormat()
Gets the formatting of the displayed text.
|
protected void |
loadFromJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
Deserializes the component from a JsonObject.
|
protected void |
loadFromXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
ComponentBase.loadFromXml override.
|
void |
readExternal(java.io.ObjectInput in)
ComponentBase.readExternal override.
|
protected void |
saveToJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
Serializes the component into a JsonObject.
|
protected void |
saveToXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
ComponentBase.saveToXml override.
|
void |
setBackground(Brush value)
Sets the brush used to fill the background of the component.
|
void |
setFont(java.awt.Font value)
Sets the font of the displayed text.
|
void |
setText(java.lang.String value)
Sets the text displayed by the component.
|
void |
setTextColor(java.awt.Color value)
Sets the color of the displayed text.
|
void |
setTextFormat(TextFormat value)
Sets the formatting of the displayed text.
|
void |
writeExternal(java.io.ObjectOutput out)
ComponentBase.writeExternal override.
|
addComponentEventListener, addComponentMouseEventListener, addComponentValidationEventListener, arrangeComponents, confirmValidating, contains, createOutlinePath, find, getBounds, getChildCount, getCursor, getDocumentBounds, getFocusable, getGridColumn, getGridRow, getHeight, getHorizontalAlignment, getIsEnabled, getIsFocused, getIsHitTestVisible, getIsInteractive, getName, getParent, getParentHost, getVerticalAlignment, getVisible, getWidth, invalidate, invalidateLayout, onAddedToParent, onContextChanged, onGotFocus, onGotFocus, onKeyDown, onKeyPress, onKeyUp, onLostFocus, onLostFocus, onMouseDown, onMouseDown, onMouseMove, onMouseMove, onMouseUp, onMouseUp, onRemovedFromParent, onUnitChanged, onValidated, onValidating, onZoomChanged, raiseValidated, removeComponentEventListener, removeComponentMouseEventListener, removeComponentValidationEventListener, serializeSubcomponents, setBounds, setFocusable, setGridColumn, setGridRow, setHeight, setHorizontalAlignment, setIsEnabled, setIsFocused, setIsHitTestVisible, setIsInteractive, setName, setParent, setVerticalAlignment, setVisible, setWidth, toDocument, toLocal, toParent
public TextComponent()
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
writeExternal
in class ComponentBase
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
readExternal
in class ComponentBase
java.io.IOException
java.lang.ClassNotFoundException
protected void saveToXml(org.w3c.dom.Element xmlElement, XmlPersistContext context)
saveToXml
in class ComponentBase
xmlElement
- An Element the component's data should be stored into.context
- An XmlPersistContext object providing contextual information about the serialization process and some helper serialization methods.protected void loadFromXml(org.w3c.dom.Element xmlElement, XmlPersistContext context) throws javax.xml.transform.TransformerException
loadFromXml
in class ComponentBase
xmlElement
- An Element containing the component's data.context
- An XmlPersistContext object providing contextual information about the serialization process and some helper serialization methods.javax.xml.transform.TransformerException
protected void saveToJson(com.mindfusion.common.JsonObject obj, JsonPersistContext context)
saveToJson
in class ComponentBase
obj
- An JsonObject containing the TextComponent datacontext
- An JsonPersistContext object providing information
about the serialization process and some helper methods.protected void loadFromJson(com.mindfusion.common.JsonObject obj, JsonPersistContext context)
loadFromJson
in class ComponentBase
obj
- An JsonObject containing the TextComponent datacontext
- An JsonPersistContext object providing information
about the serialization process and some helper methods.public void draw(java.awt.Graphics2D g2d, RenderOptions options)
draw
in class ComponentBase
g2d
- The drawing target.options
- A RenderOptions object specifying the drawing context.public XDimension2D.Double getDesiredSize(XDimension2D.Double availableSize, java.awt.Graphics2D g2d)
getDesiredSize
in class ComponentBase
availableSize
- The available size.g2d
- A relevant Graphics2D object.public java.lang.String getText()
public void setText(java.lang.String value)
value
- A String value.public java.awt.Font getFont()
public void setFont(java.awt.Font value)
value
- A Font object. The default is Arial, 10.public TextFormat getTextFormat()
public void setTextFormat(TextFormat value)
value
- A TextFormat object.public java.awt.Color getTextColor()
public void setTextColor(java.awt.Color value)
value
- A Color object. The default is Black.public Brush getBackground()
public void setBackground(Brush value)
value
- An instance of a Brush-derived class. The default is null.