for ( int i = 0; i < components.length; i++ )
{
if ( isWebStyledButton ( components[ i ] ) )
{
// Web UI
final WebButtonUI ui = ( WebButtonUI ) ( ( AbstractButton ) components[ i ] ).getUI ();
// Hiding left side
if ( lastWasButton )
{
if ( horizontal )
{
ui.setDrawLeft ( false );
ui.setDrawLeftLine ( false );
}
else
{
ui.setDrawTop ( false );
ui.setDrawTopLine ( false );
}
}
// Hiding right side
if ( i < components.length - 1 &&
( isWebStyledButton ( components[ i + 1 ] ) || isWebButtonGroup ( components[ i + 1 ] ) ) )
{
if ( horizontal )
{
ui.setDrawRight ( false );
ui.setDrawRightLine ( true );
}
else
{
ui.setDrawBottom ( false );
ui.setDrawBottomLine ( true );
}
}
lastWasButton = true;
}
else if ( isWebButtonGroup ( components[ i ] ) )
{
// WebButtonGroup
final WebButtonGroup wbg = ( WebButtonGroup ) components[ i ];
// Hiding left side
if ( lastWasButton )
{
for ( final Component component : wbg.getComponents () )
{
if ( isWebStyledButton ( component ) )
{
final WebButtonUI ui = ( WebButtonUI ) ( ( AbstractButton ) component ).getUI ();
if ( horizontal )
{
ui.setDrawLeft ( false );
ui.setDrawLeftLine ( false );
}
else
{
ui.setDrawTop ( false );
ui.setDrawTopLine ( false );
}
}
}
}
// Hiding right side
if ( i < components.length - 1 &&
( isWebStyledButton ( components[ i + 1 ] ) || isWebButtonGroup ( components[ i + 1 ] ) ) )
{
for ( final Component component : wbg.getComponents () )
{
if ( isWebStyledButton ( component ) )
{
final WebButtonUI ui = ( WebButtonUI ) ( ( AbstractButton ) component ).getUI ();
if ( horizontal )
{
ui.setDrawRight ( false );
ui.setDrawRightLine ( true );
}
else
{
ui.setDrawBottom ( false );
ui.setDrawBottomLine ( true );
}
}
}
}