FileDocCategorySizeDatePackage
SynthEditorPaneUI.javaAPI DocJava SE 5 API4698Fri Aug 26 14:58:12 BST 2005javax.swing.plaf.synth

SynthEditorPaneUI

public class SynthEditorPaneUI extends BasicEditorPaneUI implements sun.swing.plaf.synth.SynthUI
Provides the look and feel for a JEditorPane in the Synth look and feel.
author
Shannon Hickey
version
1.8 07/23/04

Fields Summary
private SynthStyle
style
private Boolean
localTrue
private Boolean
localFalse
Constructors Summary
Methods Summary
public static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent c)
Creates a UI for the JTextPane.

param
c the JTextPane component
return
the UI


                       
         
        return new SynthEditorPaneUI();
    
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()

        JComponent c = getComponent();
        Object clientProperty = 
            c.getClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES);
        if (clientProperty == null 
            || clientProperty == localFalse) {
            c.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES,
                                localTrue);
        }
        updateStyle((JTextComponent)getComponent());
    
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.
    
voidpaintBackground(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, javax.swing.JComponent c)

        context.getPainter().paintEditorPaneBackground(context, g, 0, 0,
                                                  c.getWidth(), c.getHeight());
    
public voidpaintBorder(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)

        context.getPainter().paintEditorPaneBorder(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 ActionMap based upon an EditorKit change.

param
evt the property change event

        if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
            updateStyle((JTextComponent)evt.getSource());
        }
        super.propertyChange(evt);
    
protected voiduninstallDefaults()

        SynthContext context = getContext(getComponent(), ENABLED);
        JComponent c = getComponent();
        c.putClientProperty("caretAspectRatio", null);

        style.uninstallDefaults(context);
        context.dispose();
        style = null;

        Object clientProperty = 
            c.getClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES);
        if (clientProperty == localTrue) {
            getComponent().putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES,
                                             Boolean.FALSE);
        }
        super.uninstallDefaults();
    
public voidupdate(java.awt.Graphics g, javax.swing.JComponent c)

        SynthContext context = getContext(c);

        SynthLookAndFeel.update(context, g);
        paintBackground(context, g, c);
        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();