FileDocCategorySizeDatePackage
BasicTextAreaUI.javaAPI DocJava SE 5 API10063Fri Aug 26 14:58:06 BST 2005javax.swing.plaf.basic

BasicTextAreaUI

public class BasicTextAreaUI extends BasicTextUI
Provides the look and feel for a plain text editor. In this implementation the default UI is extended to act as a simple view factory.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}.

author
Timothy Prinzing
version
1.68 01/23/03

Fields Summary
Constructors Summary
public BasicTextAreaUI()
Constructs a new BasicTextAreaUI object.

	super();
    
Methods Summary
public javax.swing.text.Viewcreate(javax.swing.text.Element elem)
Creates the view for an element. Returns a WrappedPlainView or PlainView.

param
elem the element
return
the view

	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.ViewcreateI18N(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.ComponentUIcreateUI(javax.swing.JComponent ta)
Creates a UI for a JTextArea.

param
ta a text area
return
the UI

        return new BasicTextAreaUI();
    
public java.awt.DimensiongetMinimumSize(javax.swing.JComponent c)
The method is overridden to take into account caret width.

param
c the editor component
return
the minimum size
throws
IllegalArgumentException if invalid value is passed
since
1.5

        return super.getMinimumSize(c);
        //the fix for 4785160 is undone
    
public java.awt.DimensiongetPreferredSize(javax.swing.JComponent c)
The method is overridden to take into account caret width.

param
c the editor component
return
the preferred size
throws
IllegalArgumentException if invalid value is passed
since
1.5

                    
        return super.getPreferredSize(c);                         
        //the fix for 4785160 is undone
    
protected java.lang.StringgetPropertyPrefix()
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
the name ("TextArea")

	return "TextArea";
    
protected voidinstallDefaults()

        super.installDefaults();
        //the fix for 4785160 is undone
    
protected voidpropertyChange(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.

param
evt the property change event

	if (evt.getPropertyName().equals("lineWrap") ||
	    evt.getPropertyName().equals("wrapStyleWord") ||
		evt.getPropertyName().equals("tabSize")) {
	    // rebuild the view
	    modelChanged();
	} else if ("editable".equals(evt.getPropertyName())) {
	    updateFocusTraversalKeys();
	}