src/main/java/org/jwellman/swing/Utilities.java
public static Component allowMaxWidth(JComponent c, JPanel p) {
        final LayoutManager layout = p.getLayout();
        
        if (layout instanceof BoxLayout) {
            c.setAlignmentX(0.5f);
        }

        return allowMaxWidth(c);
    }
/**
     * Same as allowMaxWidth(JComponent c) except that sometimes we need to know the container
     * so that we can use its layout setting to get proper behavior. 
     * 
     * @param titlebar
     * @param north
     * @return
     */
Same as allowMaxWidth(JComponent c) except that sometimes we need to know the container
so that we can use its layout setting to get proper behavior.

@param titlebar
@param north
@return
Same as allowMaxWidth ( JComponent c ) except that sometimes we need to know the container so that we can use its layout setting to get proper behavior . @param titlebar @param north @return
public static Component allowMaxWidth(JComponent c, JPanel p) {
        final LayoutManager layout = p.getLayout();
        if (layout instanceof BoxLayout) {
            c.setAlignmentX(0.5f);
        }
        return allowMaxWidth(c);
    }
public static Component allowMaxWidth ( JComponent c , JPanel p ) { final LayoutManager layout = p . getLayout ( ) ; if ( layout instanceof BoxLayout ) { c . setAlignmentX ( 0.5f ) ; } return allowMaxWidth ( c ) ; }
Same as allowMaxWidth(JComponent c) except that sometimes we need to know the container
 so that we can use its layout setting to get proper behavior.
Same as allowMaxWidth ( JComponent c ) except that sometimes we need to know the container so that we can use its layout setting to get proper behavior .