FileDocCategorySizeDatePackage
CenterLayout.javaAPI DocJava SE 5 API1854Fri Aug 26 14:58:00 BST 2005javax.swing.colorchooser

CenterLayout

public class CenterLayout extends Object implements Serializable, LayoutManager
Center-positioning layout manager.
version
1.10 12/19/03
author
Tom Santos
author
Steve Wilson

Fields Summary
Constructors Summary
Methods Summary
public voidaddLayoutComponent(java.lang.String name, java.awt.Component comp)

 
public voidlayoutContainer(java.awt.Container container)

	try {
	   Component c = container.getComponent( 0 );

           c.setSize( c.getPreferredSize() );
	   Dimension size = c.getSize();
           Dimension containerSize = container.getSize();
	   Insets containerInsets = container.getInsets();
	   containerSize.width -= containerInsets.left + containerInsets.right;
	   containerSize.height -= containerInsets.top + containerInsets.bottom;
	   int componentLeft = (containerSize.width / 2) - (size.width / 2);
	   int componentTop = (containerSize.height / 2) - (size.height / 2);
	   componentLeft += containerInsets.left;
	   componentTop += containerInsets.top;

	    c.setBounds( componentLeft, componentTop, size.width, size.height );
	 }
         catch( Exception e ) {
         }
    
public java.awt.DimensionminimumLayoutSize(java.awt.Container cont)

    	return preferredLayoutSize(cont);
    
public java.awt.DimensionpreferredLayoutSize(java.awt.Container container)

	Component c = container.getComponent( 0 );
	if ( c != null ) {
	    Dimension size = c.getPreferredSize();
	    Insets insets = container.getInsets();
	    size.width += insets.left + insets.right;
	    size.height += insets.top + insets.bottom;
	    return size;
	}
	else {
	    return new Dimension( 0, 0 );
	}
    
public voidremoveLayoutComponent(java.awt.Component comp)