FileDocCategorySizeDatePackage
MotifInternalFrameUI.javaAPI DocJava SE 5 API6316Fri Aug 26 14:54:46 BST 2005com.sun.java.swing.plaf.motif

MotifInternalFrameUI

public class MotifInternalFrameUI extends BasicInternalFrameUI
A Motif L&F implementation of InternalFrame.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

version
1.26 05/18/04
author
Tom Ball

Fields Summary
Color
color
Color
highlight
Color
shadow
MotifInternalFrameTitlePane
titlePane
protected KeyStroke
closeMenuKey
As of Java 2 platform v1.3 this previously undocumented field is no longer used. Key bindings are now defined by the LookAndFeel, please refer to the key bindings specification for further details.
Constructors Summary
public MotifInternalFrameUI(JInternalFrame w)

        super(w);
    
Methods Summary
protected voidactivateFrame(javax.swing.JInternalFrame f)
This method is called when the frame becomes selected.

        super.activateFrame(f);
        setColors(f);
    
public javax.swing.JComponentcreateNorthPane(javax.swing.JInternalFrame w)

        titlePane = new MotifInternalFrameTitlePane(w);
        return titlePane;
    
public static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent w)

        return new MotifInternalFrameUI((JInternalFrame)w);
    
protected voiddeactivateFrame(javax.swing.JInternalFrame f)
This method is called when the frame is no longer selected.

        setColors(f);
        super.deactivateFrame(f);
    
private javax.swing.JInternalFramegetFrame()

      return frame;
    
public java.awt.DimensiongetMaximumSize(javax.swing.JComponent x)

        return Toolkit.getDefaultToolkit().getScreenSize();
    
protected voidinstallDefaults()

	Border frameBorder = frame.getBorder();
        frame.setLayout(internalFrameLayout = createLayoutManager());
        if (frameBorder == null || frameBorder instanceof UIResource) {
            frame.setBorder(new MotifBorders.InternalFrameBorder(frame));
        }	
    
protected voidinstallKeyboardActions()

      super.installKeyboardActions();
      // We replace the 
      // we use JPopup in our TitlePane so need escape support
      closeMenuKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    
public voidinstallUI(javax.swing.JComponent c)

        super.installUI(c);
        setColors((JInternalFrame)c);
    
voidsetColors(javax.swing.JInternalFrame frame)

        if (frame.isSelected()) {
            color = UIManager.getColor("InternalFrame.activeTitleBackground");
        } else {
            color = UIManager.getColor("InternalFrame.inactiveTitleBackground");
        }
        highlight = color.brighter();
        shadow = color.darker().darker();
        titlePane.setColors(color, highlight, shadow);
    
protected voidsetupMenuCloseKey()

	ActionMap map = SwingUtilities.getUIActionMap(frame);
	if (map != null) {
	    map.put("hideSystemMenu", new AbstractAction(){
		public void actionPerformed(ActionEvent e){
		    titlePane.hideSystemMenu();
		}
		public boolean isEnabled(){
		    return isKeyBindingActive();
		}
	    });
	}

	// Set up the bindings for the DesktopIcon, it is odd that
	// we install them, and not the desktop icon.
	JInternalFrame.JDesktopIcon di = frame.getDesktopIcon();
	InputMap diInputMap = SwingUtilities.getUIInputMap
	                  (di, JComponent.WHEN_IN_FOCUSED_WINDOW);
	if (diInputMap == null) {
	    Object[] bindings = (Object[])UIManager.get
		                          ("DesktopIcon.windowBindings");
	    if (bindings != null) {
		diInputMap = LookAndFeel.makeComponentInputMap(di, bindings);

		SwingUtilities.replaceUIInputMap(di, JComponent.
					       WHEN_IN_FOCUSED_WINDOW,
					       diInputMap);
	    }
	}
	ActionMap diActionMap = SwingUtilities.getUIActionMap(di);
	if (diActionMap == null) {
	    diActionMap = new ActionMapUIResource();
	    diActionMap.put("hideSystemMenu", new AbstractAction(){
		public void actionPerformed(ActionEvent e){
		    JInternalFrame.JDesktopIcon icon = getFrame().
			             getDesktopIcon();
		    MotifDesktopIconUI micon = (MotifDesktopIconUI)icon.
			                       getUI();
		    micon.hideSystemMenu();
		}
		public boolean isEnabled(){
		    return isKeyBindingActive();
		}
	    });
	    SwingUtilities.replaceUIActionMap(di, diActionMap);
	}
    
protected voidsetupMenuOpenKey()

	super.setupMenuOpenKey();
	ActionMap map = SwingUtilities.getUIActionMap(frame);
	if (map != null) {
	    // BasicInternalFrameUI creates an action with the same name, we override
	    // it as MotifInternalFrameTitlePane has a titlePane ivar that shadows the
	    // titlePane ivar in BasicInternalFrameUI, making supers action throw
	    // an NPE for us.
	    map.put("showSystemMenu", new AbstractAction(){
		public void actionPerformed(ActionEvent e){
		    titlePane.showSystemMenu();
		}
		public boolean isEnabled(){
		    return isKeyBindingActive();
		}
	    });
	}
    
protected voiduninstallDefaults()

        LookAndFeel.uninstallBorder(frame);
        frame.setLayout(null);
        internalFrameLayout = null;
    
protected voiduninstallKeyboardActions()

      super.uninstallKeyboardActions();
      if (isKeyBindingRegistered()){
	JInternalFrame.JDesktopIcon di = frame.getDesktopIcon();
	SwingUtilities.replaceUIActionMap(di, null);
	SwingUtilities.replaceUIInputMap(di, JComponent.WHEN_IN_FOCUSED_WINDOW,
					 null);
      }