FileDocCategorySizeDatePackage
MetalInternalFrameUI.javaAPI DocJava SE 6 API7185Tue Jun 10 00:26:50 BST 2008javax.swing.plaf.metal

MetalInternalFrameUI

public class MetalInternalFrameUI extends BasicInternalFrameUI
Metal implementation of JInternalFrame.

version
1.35 04/07/06
author
Steve Wilson

Fields Summary
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.event.MouseInputAdaptercreateBorderListener(javax.swing.JInternalFrame w)
Returns the MouseInputAdapter that will be installed on the TitlePane.

param
w the JInternalFrame
return
the MouseInputAdapter that will be installed on the TitlePane.
since
1.6

        return new BorderListener1();
    
protected javax.swing.JComponentcreateNorthPane(javax.swing.JInternalFrame w)

      return new MetalInternalFrameTitlePane(w);
  
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");
          ((MetalInternalFrameTitlePane)titlePane).setPalette( false );
      }
      else if ( frameType.equals( PALETTE_FRAME ) )
      {
          LookAndFeel.installBorder(frame, "InternalFrame.paletteBorder");
          ((MetalInternalFrameTitlePane)titlePane).setPalette( true );
      }
      else
      {
          LookAndFeel.installBorder(frame, "InternalFrame.border");
          ((MetalInternalFrameTitlePane)titlePane).setPalette( false );
      }
  
public voidsetPalette(boolean isPalette)

    if (isPalette) {
        LookAndFeel.installBorder(frame, "InternalFrame.paletteBorder");
    } else {
        LookAndFeel.installBorder(frame, "InternalFrame.border");
    }
    ((MetalInternalFrameTitlePane)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);