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

SynthMenuBarUI

public class SynthMenuBarUI extends BasicMenuBarUI implements sun.swing.plaf.synth.SynthUI, PropertyChangeListener
Synth's MenuBarUI.
version
1.10, 12/19/03
author
Scott Violet

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

	return new SynthMenuBarUI();
    
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);
    
private javax.swing.plaf.synth.RegiongetRegion(javax.swing.JComponent c)

        return SynthLookAndFeel.getRegion(c);
    
protected voidinstallDefaults()

	if (menuBar.getLayout() == null ||
	    menuBar.getLayout() instanceof UIResource) {
            menuBar.setLayout(new DefaultMenuLayout(menuBar,BoxLayout.LINE_AXIS));
        }
        updateStyle(menuBar);
    
protected voidinstallListeners()

        super.installListeners();
        menuBar.addPropertyChangeListener(this);
    
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)

        context.getPainter().paintMenuBarBorder(context, g, x, y, w, h);
    
public voidpropertyChange(java.beans.PropertyChangeEvent e)

        if (SynthLookAndFeel.shouldUpdateStyle(e)) {
            updateStyle((JMenuBar)e.getSource());
        }
    
protected voiduninstallDefaults()

        SynthContext context = getContext(menuBar, ENABLED);

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

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

        SynthContext context = getContext(c);

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

        SynthContext context = getContext(c, ENABLED);
        SynthStyle oldStyle = style;
        style = SynthLookAndFeel.updateStyle(context, this);
        if (style != oldStyle) {
            if (oldStyle != null) {
                uninstallKeyboardActions();
                installKeyboardActions();
            }
        }
        context.dispose();