FileDocCategorySizeDatePackage
MetalInternalFrameUI.javaAPI DocJava SE 5 API5384Fri Aug 26 14:58:06 BST 2005javax.swing.plaf.metal

MetalInternalFrameUI

public class MetalInternalFrameUI extends BasicInternalFrameUI
Metal implementation of JInternalFrame.

version
1.30 12/19/03
author
Steve Wilson

Fields Summary
private MetalInternalFrameTitlePane
titlePane
private static final PropertyChangeListener
metalPropertyChangeListener
private static final Border
handyEmptyBorder
protected static String
IS_PALETTE
private static String
FRAME_TYPE
private static String
NORMAL_FRAME
private static String
PALETTE_FRAME
private static String
OPTION_DIALOG
Constructors Summary
public MetalInternalFrameUI(JInternalFrame b)


       
    super(b);
  
Methods Summary
protected javax.swing.JComponentcreateNorthPane(javax.swing.JInternalFrame w)

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

      return new MetalInternalFrameUI( (JInternalFrame) c);
  
protected voidinstallKeyboardActions()

      super.installKeyboardActions();
      ActionMap map = SwingUtilities.getUIActionMap(frame);
      if (map != null) {
	  // BasicInternalFrameUI creates an action with the same name, we override
	  // it as Metal frames do not have system menus.
	  map.remove("showSystemMenu");
      }
  
protected voidinstallListeners()

        super.installListeners();
        frame.addPropertyChangeListener(metalPropertyChangeListener);
    
public voidinstallUI(javax.swing.JComponent c)

 
    super.installUI(c);

    Object paletteProp = c.getClientProperty( IS_PALETTE );
    if ( paletteProp != null ) {
	setPalette( ((Boolean)paletteProp).booleanValue() );
    }

    Container content = frame.getContentPane();
    stripContentBorder(content);    
    //c.setOpaque(false);
  
private voidsetFrameType(java.lang.String frameType)

      if ( frameType.equals( OPTION_DIALOG ) )
      {
          LookAndFeel.installBorder(frame, "InternalFrame.optionDialogBorder");
	  titlePane.setPalette( false );
      }
      else if ( frameType.equals( PALETTE_FRAME ) )
      {
          LookAndFeel.installBorder(frame, "InternalFrame.paletteBorder");
	  titlePane.setPalette( true );
      }
      else
      {
          LookAndFeel.installBorder(frame, "InternalFrame.border");
	  titlePane.setPalette( false );
      }
  
public voidsetPalette(boolean isPalette)

    if (isPalette) {
        LookAndFeel.installBorder(frame, "InternalFrame.paletteBorder");
    } else {
        LookAndFeel.installBorder(frame, "InternalFrame.border");
    }
    titlePane.setPalette(isPalette);

  
private voidstripContentBorder(java.lang.Object c)

        if ( c instanceof JComponent ) {
            JComponent contentComp = (JComponent)c;
            Border contentBorder = contentComp.getBorder();
   	    if (contentBorder == null || contentBorder instanceof UIResource) {
	        contentComp.setBorder( handyEmptyBorder );
            }
        }
  
protected voiduninstallComponents()

        titlePane = null;
        super.uninstallComponents();
    
protected voiduninstallKeyboardActions()

      super.uninstallKeyboardActions();
  
protected voiduninstallListeners()

        frame.removePropertyChangeListener(metalPropertyChangeListener);
        super.uninstallListeners();
    
public voiduninstallUI(javax.swing.JComponent c)

                  
      frame = (JInternalFrame)c;

      Container cont = ((JInternalFrame)(c)).getContentPane();
      if (cont instanceof JComponent) {
	JComponent content = (JComponent)cont;
	if ( content.getBorder() == handyEmptyBorder) {
	  content.setBorder(null);
	}
      }
      super.uninstallUI(c);