@Override public void paint(final PPaintContext ppc){
  final Paint paint=getPaint();
  if (paint != null) {
    final Graphics2D g2=ppc.getGraphics();
    final PBounds bounds=getUnionOfChildrenBounds(null);
    if (fillBackground) {
      g2.setPaint(backgroundColor);
      g2.fillRect((int)bounds.getX() - outlinePadding,(int)bounds.getY() - outlinePadding,(int)bounds.getWidth() + 2 * outlinePadding,(int)bounds.getHeight() + 2 * outlinePadding);
    }
    if (drawOutline) {
      g2.setPaint(lineColor);
      g2.drawRoundRect((int)bounds.getX() - outlinePadding,(int)bounds.getY() - outlinePadding,(int)bounds.getWidth() + 2 * outlinePadding,(int)bounds.getHeight() + 2 * outlinePadding,ROUNDING_WIDTH_HEIGHT,ROUNDING_WIDTH_HEIGHT);
    }
  }
}

@ Override public void paint ( final PPaintContext ppc ) { final Paint paint = getPaint ( ) ; if ( paint != null ) { final Graphics2D g2 = ppc . getGraphics ( ) ; final PBounds bounds = getUnionOfChildrenBounds ( null ) ; if ( fillBackground ) { g2 . setPaint ( backgroundColor ) ; g2 . fillRect ( ( int ) bounds . getX ( ) - outlinePadding , ( int ) bounds . getY ( ) - outlinePadding , ( int ) bounds . getWidth ( ) + 2 * outlinePadding , ( int ) bounds . getHeight ( ) + 2 * outlinePadding ) ; } if ( drawOutline ) { g2 . setPaint ( lineColor ) ; g2 . drawRoundRect ( ( int ) bounds . getX ( ) - outlinePadding , ( int ) bounds . getY ( ) - outlinePadding , ( int ) bounds . getWidth ( ) + 2 * outlinePadding , ( int ) bounds . getHeight ( ) + 2 * outlinePadding , ROUNDING_WIDTH_HEIGHT , ROUNDING_WIDTH_HEIGHT ) ; } } }
change the default paint to fill an expanded bounding box based on its children ' s bounds .
