FileDocCategorySizeDatePackage
BasicRootPaneUI.javaAPI DocJava SE 5 API7507Fri Aug 26 14:58:04 BST 2005javax.swing.plaf.basic

BasicRootPaneUI

public class BasicRootPaneUI extends RootPaneUI implements PropertyChangeListener
Basic implementation of RootPaneUI, there is one shared between all JRootPane instances.
version
1.15 12/19/03
author
Scott Violet

Fields Summary
private static RootPaneUI
rootPaneUI
Constructors Summary
Methods Summary
javax.swing.ComponentInputMapcreateInputMap(int condition, javax.swing.JComponent c)

	return new RootPaneInputMap(c);
    
public static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent c)


         
        return rootPaneUI;
    
javax.swing.InputMapgetInputMap(int condition, javax.swing.JComponent c)

        if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) {
            return (InputMap)DefaultLookup.get(c, this,
                                       "RootPane.ancestorInputMap");
        }

	if (condition == JComponent.WHEN_IN_FOCUSED_WINDOW) {
	    return createInputMap(condition, c);
	}
	return null;
    
protected voidinstallComponents(javax.swing.JRootPane root)

    
protected voidinstallDefaults(javax.swing.JRootPane c)

        LookAndFeel.installProperty(c, "opaque", Boolean.FALSE);
    
protected voidinstallKeyboardActions(javax.swing.JRootPane root)

	InputMap km = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW, root);
	SwingUtilities.replaceUIInputMap(root,
                JComponent.WHEN_IN_FOCUSED_WINDOW, km);
        km = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
                root);
        SwingUtilities.replaceUIInputMap(root,
                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, km);

        LazyActionMap.installLazyActionMap(root, BasicRootPaneUI.class,
                "RootPane.actionMap");
	updateDefaultButtonBindings(root);
    
protected voidinstallListeners(javax.swing.JRootPane root)

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

 
        installDefaults((JRootPane)c);
        installComponents((JRootPane)c);
        installListeners((JRootPane)c);
        installKeyboardActions((JRootPane)c);
    
static voidloadActionMap(javax.swing.plaf.basic.LazyActionMap map)

	map.put(new Actions(Actions.PRESS));
	map.put(new Actions(Actions.RELEASE));
	map.put(new Actions(Actions.POST_POPUP));
    
public voidpropertyChange(java.beans.PropertyChangeEvent e)
Invoked when a property changes on the root pane. If the event indicates the defaultButton has changed, this will reinstall the keyboard actions.

	if(e.getPropertyName().equals("defaultButton")) {
	    JRootPane rootpane = (JRootPane)e.getSource();
	    updateDefaultButtonBindings(rootpane);
	    if (rootpane.getClientProperty("temporaryDefaultButton") == null) {
		rootpane.putClientProperty("initialDefaultButton", e.getNewValue());
	    }
	}
    
protected voiduninstallComponents(javax.swing.JRootPane root)

    
protected voiduninstallDefaults(javax.swing.JRootPane root)

    
protected voiduninstallKeyboardActions(javax.swing.JRootPane root)

	SwingUtilities.replaceUIInputMap(root, JComponent.
				       WHEN_IN_FOCUSED_WINDOW, null);
	SwingUtilities.replaceUIActionMap(root, null);
    
protected voiduninstallListeners(javax.swing.JRootPane root)

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

 
        uninstallDefaults((JRootPane)c);
        uninstallComponents((JRootPane)c);
        uninstallListeners((JRootPane)c);
        uninstallKeyboardActions((JRootPane)c);
    
voidupdateDefaultButtonBindings(javax.swing.JRootPane root)
Invoked when the default button property has changed. This reloads the bindings from the defaults table with name RootPane.defaultButtonWindowKeyBindings.

	InputMap km = SwingUtilities.getUIInputMap(root, JComponent.
					       WHEN_IN_FOCUSED_WINDOW);
	while (km != null && !(km instanceof RootPaneInputMap)) {
	    km = km.getParent();
	}
	if (km != null) {
	    km.clear();
	    if (root.getDefaultButton() != null) {
		Object[] bindings = (Object[])DefaultLookup.get(root, this,
                           "RootPane.defaultButtonWindowKeyBindings");
		if (bindings != null) {
		    LookAndFeel.loadKeyBindings(km, bindings);
		}
	    }
	}