FileDocCategorySizeDatePackage
SynthTextAreaUI.javaAPI DocJava SE 6 API4417Tue Jun 10 00:26:56 BST 2008javax.swing.plaf.synth

SynthTextAreaUI

public class SynthTextAreaUI extends BasicTextAreaUI implements sun.swing.plaf.synth.SynthUI
Provides the look and feel for a plain text editor in the Synth look and feel. 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
Shannon Hickey
version
1.10 01/24/06

Fields Summary
private SynthStyle
style
Constructors Summary
Methods Summary
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 SynthTextAreaUI();
    
private intgetComponentState(javax.swing.JComponent c)

        return SynthLookAndFeel.getComponentState(c);
    
public javax.swing.plaf.synth.SynthContextgetContext(javax.swing.JComponent c)

        return getContext(c, getComponentState(c));
    
private javax.swing.plaf.synth.SynthContextgetContext(javax.swing.JComponent c, int state)

        return SynthContext.getContext(SynthContext.class, c,
                    SynthLookAndFeel.getRegion(c), style, state);
    
protected voidinstallDefaults()

        // Installs the text cursor on the component
        super.installDefaults();
        updateStyle((JTextComponent)getComponent());
    
public voidinstallUI(javax.swing.JComponent c)

        super.installUI(c);
    
protected voidpaint(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g)

        super.paint(g, getComponent());
    
protected voidpaintBackground(java.awt.Graphics g)

        // Overriden to do nothing, all our painting is done from update/paint.
    
public voidpaintBorder(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)

        context.getPainter().paintTextAreaBorder(context, g, x, y, w, h);
    
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 (SynthLookAndFeel.shouldUpdateStyle(evt)) {
            updateStyle((JTextComponent)evt.getSource());
        }
        super.propertyChange(evt);
    
protected voiduninstallDefaults()

        SynthContext context = getContext(getComponent(), ENABLED);

        getComponent().putClientProperty("caretAspectRatio", null);

        style.uninstallDefaults(context);
        context.dispose();
        style = null;
        super.uninstallDefaults();
    
public voidupdate(java.awt.Graphics g, javax.swing.JComponent c)

        SynthContext context = getContext(c);

        SynthLookAndFeel.update(context, g);
        context.getPainter().paintTextAreaBackground(context,
                          g, 0, 0, c.getWidth(), c.getHeight());
        paint(context, g);
        context.dispose();
    
private voidupdateStyle(javax.swing.text.JTextComponent comp)

        SynthContext context = getContext(comp, ENABLED);
        SynthStyle oldStyle = style;

        style = SynthLookAndFeel.updateStyle(context, this);

        if (style != oldStyle) {
            SynthTextFieldUI.updateStyle(comp, context, getPropertyPrefix());

            if (oldStyle != null) {
                uninstallKeyboardActions();
                installKeyboardActions();
            }
        }
        context.dispose();