FileDocCategorySizeDatePackage
SynthSeparatorUI.javaAPI DocJava SE 6 API5494Tue Jun 10 00:26:54 BST 2008javax.swing.plaf.synth

SynthSeparatorUI

public class SynthSeparatorUI extends SeparatorUI implements sun.swing.plaf.synth.SynthUI, PropertyChangeListener
A Synth L&F implementation of SeparatorUI. This implementation is a "combined" view/controller.
version
1.16 11/17/05
author
Shannon Hickey
author
Joshua Outwater

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

        return new SynthSeparatorUI();
    
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);
    
public java.awt.DimensiongetMaximumSize(javax.swing.JComponent c)

        return new Dimension(Short.MAX_VALUE, Short.MAX_VALUE);
    
public java.awt.DimensiongetMinimumSize(javax.swing.JComponent c)

        return getPreferredSize(c);
    
public java.awt.DimensiongetPreferredSize(javax.swing.JComponent c)

        SynthContext context = getContext(c);

        int thickness = style.getInt(context, "Separator.thickness", 2);
        Insets insets = c.getInsets();
        Dimension size;

        if (((JSeparator)c).getOrientation() == JSeparator.VERTICAL) {
            size = new Dimension(insets.left + insets.right + thickness,
                                 insets.top + insets.bottom);
        } else {
            size = new Dimension(insets.left + insets.right,
                                 insets.top + insets.bottom + thickness);
        }
        context.dispose();
        return size;
    
private javax.swing.plaf.synth.RegiongetRegion(javax.swing.JComponent c)

        return SynthLookAndFeel.getRegion(c);
    
public voidinstallDefaults(javax.swing.JSeparator c)

        updateStyle(c);
    
public voidinstallListeners(javax.swing.JSeparator c)

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

        installDefaults((JSeparator)c);
        installListeners((JSeparator)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)

        JSeparator separator = (JSeparator)context.getComponent();
        context.getPainter().paintSeparatorForeground(context, g, 0, 0,
                             separator.getWidth(), separator.getHeight(),
                             separator.getOrientation());
    
public voidpaintBorder(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)

        JSeparator separator = (JSeparator)context.getComponent();
        context.getPainter().paintSeparatorBorder(context, g, x, y, w, h,
                                                  separator.getOrientation());
    
public voidpropertyChange(java.beans.PropertyChangeEvent evt)

        if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
            updateStyle((JSeparator)evt.getSource());
        }
    
public voiduninstallDefaults(javax.swing.JComponent c)

        uninstallListeners((JSeparator)c);
        uninstallDefaults((JSeparator)c);
    
public voiduninstallDefaults(javax.swing.JSeparator c)

        SynthContext context = getContext(c, ENABLED);

        style.uninstallDefaults(context);
        context.dispose();
        style = null;
    
public voiduninstallListeners(javax.swing.JSeparator c)

        c.removePropertyChangeListener(this);
    
public voidupdate(java.awt.Graphics g, javax.swing.JComponent c)

        SynthContext context = getContext(c);

        JSeparator separator = (JSeparator)context.getComponent();
        SynthLookAndFeel.update(context, g);
        context.getPainter().paintSeparatorBackground(context,
                          g, 0, 0, c.getWidth(), c.getHeight(),
                          separator.getOrientation());
        paint(context, g);
        context.dispose();
    
private voidupdateStyle(javax.swing.JSeparator sep)

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

        style = SynthLookAndFeel.updateStyle(context, this);

        if (style != oldStyle) {
            if (sep instanceof JToolBar.Separator) {
                Dimension size = ((JToolBar.Separator)sep).getSeparatorSize();
                if (size == null || size instanceof UIResource) {
                    size = (DimensionUIResource)style.get(
                                      context, "ToolBar.separatorSize");
                    if (size == null) {
                        size = new DimensionUIResource(10, 10);
                    }
                    ((JToolBar.Separator)sep).setSeparatorSize(size);
                }
            }
        }

        context.dispose();