FileDocCategorySizeDatePackage
SynthViewportUI.javaAPI DocJava SE 5 API3836Fri Aug 26 14:58:14 BST 2005javax.swing.plaf.synth

SynthViewportUI

public class SynthViewportUI extends ViewportUI implements sun.swing.plaf.synth.SynthUI, PropertyChangeListener
Synth's ViewportUI.
version
1.11, 12/19/03

Fields Summary
private SynthStyle
style
Constructors Summary
Methods Summary
public static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent c)

        return new SynthViewportUI();
    
private intgetComponentState(javax.swing.JComponent c)

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

        return SynthContext.getContext(SynthContext.class, c,
                                       getRegion(c), style, state);
    
public javax.swing.plaf.synth.SynthContextgetContext(javax.swing.JComponent c)

        return getContext(c, getComponentState(c));
    
private javax.swing.plaf.synth.RegiongetRegion(javax.swing.JComponent c)

        return SynthLookAndFeel.getRegion(c);
    
protected voidinstallDefaults(javax.swing.JComponent c)

        updateStyle(c);
    
protected voidinstallListeners(javax.swing.JComponent c)

        c.addPropertyChangeListener(this);
    
public voidinstallUI(javax.swing.JComponent c)

        super.installUI(c);
        installDefaults(c);
        installListeners(c);
    
public voidpaint(java.awt.Graphics g, javax.swing.JComponent c)

        SynthContext context = getContext(c);

        paint(context, g);
        context.dispose();
    
protected voidpaint(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g)

    
public voidpaintBorder(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)

        // This does nothing on purpose, JViewport doesn't allow a border
        // and therefor this will NEVER be called.
    
public voidpropertyChange(java.beans.PropertyChangeEvent e)

        if (SynthLookAndFeel.shouldUpdateStyle(e)) {
            updateStyle((JComponent)e.getSource());
        }
    
protected voiduninstallDefaults(javax.swing.JComponent c)

        SynthContext context = getContext(c, ENABLED);
        style.uninstallDefaults(context);
        context.dispose();
        style = null;
    
protected voiduninstallListeners(javax.swing.JComponent c)

        c.removePropertyChangeListener(this);
    
public voiduninstallUI(javax.swing.JComponent c)

        super.uninstallUI(c);
        uninstallListeners(c);
        uninstallDefaults(c);
    
public voidupdate(java.awt.Graphics g, javax.swing.JComponent c)

        SynthContext context = getContext(c);

        SynthLookAndFeel.update(context, g);
        context.getPainter().paintViewportBackground(context,
                          g, 0, 0, c.getWidth(), c.getHeight());
        paint(context, g);
        context.dispose();
    
private voidupdateStyle(javax.swing.JComponent c)

        SynthContext context = getContext(c, ENABLED);

        // Note: JViewport is special cased as it does not allow for
        // a border to be set. JViewport.setBorder is overriden to throw
        // an IllegalArgumentException. Refer to SynthScrollPaneUI for
        // details of this.
        SynthStyle newStyle = SynthLookAndFeel.getStyle(context.getComponent(),
                                                        context.getRegion());
        SynthStyle oldStyle = context.getStyle();

        if (newStyle != oldStyle) {
            if (oldStyle != null) {
                oldStyle.uninstallDefaults(context);
            }
            context.setStyle(newStyle);
            newStyle.installDefaults(context);
        }
        this.style = newStyle;
        context.dispose();