public void paint ( final Graphics2D g2d, final Rectangle bounds, final E c )
{
if ( !undecorated )
{
// Painting background decoration
final NinePatchIcon backgroundIcon = getCurrentBackgroundIcon ();
if ( backgroundIcon != null )
{
backgroundIcon.paintIcon ( g2d, getBackgroundBounds ( backgroundIcon, bounds, c ) );
}
// Painting appropriate separators
if ( isTopLineShouldBePainted () )
{
final NinePatchIcon icon = getCurrentTopSeparatorIcon ();
if ( icon != null )
{
final Dimension ps = icon.getPreferredSize ();
icon.paintIcon ( g2d, bounds.x, bounds.y, bounds.width, ps.height );
}
}
if ( isLeftLineShouldBePainted () )
{
final NinePatchIcon icon = getCurrentLeftSeparatorIcon ();
if ( icon != null )
{
final Dimension ps = icon.getPreferredSize ();
icon.paintIcon ( g2d, bounds.x, bounds.y, ps.width, bounds.height );
}
}
if ( isBottomLineShouldBePainted () )
{
final NinePatchIcon icon = getCurrentBottomSeparatorIcon ();
if ( icon != null )
{
final Dimension ps = icon.getPreferredSize ();
icon.paintIcon ( g2d, bounds.x, bounds.y + bounds.height - ps.height, bounds.width, ps.height );
}
}
if ( isRightLineShouldBePainted () )
{
final NinePatchIcon icon = getCurrentRightSeparatorIcon ();
if ( icon != null )
{
final Dimension ps = icon.getPreferredSize ();
icon.paintIcon ( g2d, bounds.x + bounds.width - ps.width, bounds.y, ps.width, bounds.height );
}
}
}
}