Methods Summary |
---|
void | _updateModelFromText()This is subclassed to put the text on the Comment attribute of
the Element's AttributeSet.
JTextComponent textC = getTextComponent();
Document doc = getDocument();
if (textC != null && doc != null) {
String text = textC.getText();
SimpleAttributeSet sas = new SimpleAttributeSet();
isSettingAttributes = true;
try {
sas.addAttribute(HTML.Attribute.COMMENT, text);
((StyledDocument)doc).setCharacterAttributes
(getStartOffset(), getEndOffset() -
getStartOffset(), sas, false);
}
finally {
isSettingAttributes = false;
}
}
|
protected java.awt.Component | createComponent()
Container host = getContainer();
if (host != null && !((JTextComponent)host).isEditable()) {
return null;
}
JTextArea ta = new JTextArea(getRepresentedText());
Document doc = getDocument();
Font font;
if (doc instanceof StyledDocument) {
font = ((StyledDocument)doc).getFont(getAttributes());
ta.setFont(font);
}
else {
font = ta.getFont();
}
updateYAlign(font);
ta.setBorder(CBorder);
ta.getDocument().addDocumentListener(this);
ta.setFocusable(isVisible());
return ta;
|
java.lang.String | getRepresentedText()
AttributeSet as = getElement().getAttributes();
if (as != null) {
Object comment = as.getAttribute(HTML.Attribute.COMMENT);
if (comment instanceof String) {
return (String)comment;
}
}
return "";
|
javax.swing.text.JTextComponent | getTextComponent()
return (JTextComponent)getComponent();
|
void | resetBorder()
|