Methods Summary |
---|
public javax.swing.text.View | create(javax.swing.text.Element elem)Creates the view for an element. Returns a WrappedPlainView or
PlainView.
Document doc = elem.getDocument();
Object i18nFlag = doc.getProperty("i18n"/*AbstractDocument.I18NProperty*/);
if ((i18nFlag != null) && i18nFlag.equals(Boolean.TRUE)) {
// build a view that support bidi
return createI18N(elem);
} else {
JTextComponent c = getComponent();
if (c instanceof JTextArea) {
JTextArea area = (JTextArea) c;
View v;
if (area.getLineWrap()) {
v = new WrappedPlainView(elem, area.getWrapStyleWord());
} else {
v = new PlainView(elem);
}
return v;
}
}
return null;
|
javax.swing.text.View | createI18N(javax.swing.text.Element elem)
String kind = elem.getName();
if (kind != null) {
if (kind.equals(AbstractDocument.ContentElementName)) {
return new PlainParagraph(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return new BoxView(elem, View.Y_AXIS);
}
}
return null;
|
public static javax.swing.plaf.ComponentUI | createUI(javax.swing.JComponent ta)Creates a UI for a JTextArea.
return new BasicTextAreaUI();
|
public int | getBaseline(javax.swing.JComponent c, int width, int height)Returns the baseline.
super.getBaseline(c, width, height);
Object i18nFlag = ((JTextComponent)c).getDocument().
getProperty("i18n");
Insets insets = c.getInsets();
if (Boolean.TRUE.equals(i18nFlag)) {
View rootView = getRootView((JTextComponent)c);
if (rootView.getViewCount() > 0) {
height = height - insets.top - insets.bottom;
int baseline = insets.top;
int fieldBaseline = BasicHTML.getBaseline(
rootView.getView(0), width - insets.left -
insets.right, height);
if (fieldBaseline < 0) {
return -1;
}
return baseline + fieldBaseline;
}
return -1;
}
FontMetrics fm = c.getFontMetrics(c.getFont());
return insets.top + fm.getAscent();
|
public java.awt.Component$BaselineResizeBehavior | getBaselineResizeBehavior(javax.swing.JComponent c)Returns an enum indicating how the baseline of the component
changes as the size changes.
super.getBaselineResizeBehavior(c);
return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
|
public java.awt.Dimension | getMinimumSize(javax.swing.JComponent c)The method is overridden to take into account caret width.
return super.getMinimumSize(c);
//the fix for 4785160 is undone
|
public java.awt.Dimension | getPreferredSize(javax.swing.JComponent c)The method is overridden to take into account caret width.
return super.getPreferredSize(c);
//the fix for 4785160 is undone
|
protected java.lang.String | getPropertyPrefix()Fetches the name used as a key to look up properties through the
UIManager. This is used as a prefix to all the standard
text properties.
return "TextArea";
|
protected void | installDefaults()
super.installDefaults();
//the fix for 4785160 is undone
|
protected void | propertyChange(java.beans.PropertyChangeEvent evt)This method gets called when a bound property is changed
on the associated JTextComponent. This is a hook
which UI implementations may change to reflect how the
UI displays bound properties of JTextComponent subclasses.
This is implemented to rebuild the View when the
WrapLine or the WrapStyleWord property changes.
super.propertyChange(evt);
if (evt.getPropertyName().equals("lineWrap") ||
evt.getPropertyName().equals("wrapStyleWord") ||
evt.getPropertyName().equals("tabSize")) {
// rebuild the view
modelChanged();
} else if ("editable".equals(evt.getPropertyName())) {
updateFocusTraversalKeys();
}
|