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

SynthInternalFrameUI

public class SynthInternalFrameUI extends BasicInternalFrameUI implements sun.swing.plaf.synth.SynthUI, PropertyChangeListener
Synth's InternalFrameUI.
version
1.20 04/16/04
author
David Kloba
author
Joshua Outwater
author
Rich Schiavi

Fields Summary
private SynthStyle
style
private static DesktopManager
sharedDesktopManager
private boolean
componentListenerAdded
private Rectangle
parentBounds
Constructors Summary
public SynthInternalFrameUI(JInternalFrame b)

        super(b);
    
Methods Summary
protected java.awt.event.ComponentListenercreateComponentListener()

	if (UIManager.getBoolean("InternalFrame.useTaskBar")) {
	    return new ComponentHandler() {
		public void componentResized(ComponentEvent e) {
		    if (frame != null && frame.isMaximum()) {
			JDesktopPane desktop = (JDesktopPane)e.getSource();
			for (Component comp : desktop.getComponents()) {
			    if (comp instanceof SynthDesktopPaneUI.TaskBar) {
				frame.setBounds(0, 0,
						desktop.getWidth(),
						desktop.getHeight() - comp.getHeight());
				frame.revalidate();
				break;
			    }
			}
		    }

		    // Update the new parent bounds for next resize, but don't
		    // let the super method touch this frame
		    JInternalFrame f = frame;
		    frame = null;
		    super.componentResized(e);
		    frame = f;
		}
	    };
	} else {
	    return super.createComponentListener();
	}
    
protected javax.swing.JComponentcreateNorthPane(javax.swing.JInternalFrame w)

        titlePane = new SynthInternalFrameTitlePane(w);
	titlePane.setName("InternalFrame.northPane");
        return titlePane;
    
public static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent b)


         
        return new SynthInternalFrameUI((JInternalFrame)b);
    
public 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,
                            SynthLookAndFeel.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);
    
public voidinstallDefaults()

        frame.setLayout(internalFrameLayout = createLayoutManager());
        updateStyle(frame);
    
protected voidinstallListeners()

        super.installListeners();
        frame.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().paintInternalFrameBorder(context,
                                                            g, x, y, w, h);
    
public voidpropertyChange(java.beans.PropertyChangeEvent evt)

        if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
            updateStyle((JInternalFrame)evt.getSource());
        }
    
protected voiduninstallComponents()

	if (frame.getComponentPopupMenu() instanceof UIResource) {
	    frame.setComponentPopupMenu(null);
	}
	super.uninstallComponents();
    
protected voiduninstallDefaults()

        SynthContext context = getContext(frame, ENABLED);
        style.uninstallDefaults(context);
        context.dispose();
        style = null;
        if(frame.getLayout() == internalFrameLayout) {
            frame.setLayout(null);
        }

    
protected voiduninstallListeners()

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

        SynthContext context = getContext(c);

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

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

        style = SynthLookAndFeel.updateStyle(context, this);
        if (style != oldStyle) {
            Icon frameIcon = frame.getFrameIcon();
            if (frameIcon == null || frameIcon instanceof UIResource) {
                frame.setFrameIcon(context.getStyle().getIcon(
                                   context, "InternalFrame.icon"));
            }
            if (oldStyle != null) {
                uninstallKeyboardActions();
                installKeyboardActions();
            }
        }
        context.dispose();