Methods Summary |
---|
public javax.swing.text.View | create(javax.swing.text.Element elem)Creates a view (FieldView) based on an element.
Document doc = elem.getDocument();
Object i18nFlag = doc.getProperty("i18n"/*AbstractDocument.I18NProperty*/);
if (Boolean.TRUE.equals(i18nFlag)) {
// To support bidirectional text, we build a more heavyweight
// representation of the field.
String kind = elem.getName();
if (kind != null) {
if (kind.equals(AbstractDocument.ContentElementName)) {
return new GlyphView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return new I18nFieldView(elem);
}
}
// this shouldn't happen, should probably throw in this case.
}
return new FieldView(elem);
|
public static javax.swing.plaf.ComponentUI | createUI(javax.swing.JComponent c)Creates a UI for a JTextField.
return new BasicTextFieldUI();
|
public int | getBaseline(javax.swing.JComponent c, int width, int height)Returns the baseline.
super.getBaseline(c, width, height);
View rootView = getRootView((JTextComponent)c);
if (rootView.getViewCount() > 0) {
Insets insets = c.getInsets();
height = height - insets.top - insets.bottom;
if (height > 0) {
int baseline = insets.top;
View fieldView = rootView.getView(0);
int vspan = (int)fieldView.getPreferredSpan(View.Y_AXIS);
if (height != vspan) {
int slop = height - vspan;
baseline += slop / 2;
}
if (fieldView instanceof I18nFieldView) {
int fieldBaseline = BasicHTML.getBaseline(
fieldView, width - insets.left - insets.right,
height);
if (fieldBaseline < 0) {
return -1;
}
baseline += fieldBaseline;
}
else {
FontMetrics fm = c.getFontMetrics(c.getFont());
baseline += fm.getAscent();
}
return baseline;
}
}
return -1;
|
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.CENTER_OFFSET;
|
protected java.lang.String | getPropertyPrefix()Fetches the name used as a key to lookup properties through the
UIManager. This is used as a prefix to all the standard
text properties.
return "TextField";
|