final int iAnchor = lg.getAnchor( ).getValue( );
int iAnchor = lg.getAnchor( ).getValue( );   if ( rtc.isRightToLeft( ) ) { if ( iAnchor == Anchor.EAST ) { iAnchor = Anchor.WEST; } else if ( iAnchor == Anchor.NORTH_EAST ) { iAnchor = Anchor.NORTH_WEST; } else if ( iAnchor == Anchor.SOUTH_EAST ) { iAnchor = Anchor.SOUTH_WEST; } else if ( iAnchor == Anchor.WEST ) { iAnchor = Anchor.EAST; } else if ( iAnchor == Anchor.NORTH_WEST ) { iAnchor = Anchor.NORTH_EAST; } else if ( iAnchor == Anchor.SOUTH_WEST ) { iAnchor = Anchor.SOUTH_EAST; } }
	private static final void updateLegendInside( Bounds boContainer,			Legend lg, IDisplayServer ids, Chart cm, RunTimeContext rtc )			throws ChartException	{		final double dScale = ids.getDpiResolution( ) / 72d;		double dX, dY;		final Size sz = lg.getPreferredSize( ids, cm, rtc );		boContainer = boContainer.scaledInstance( 1d / dScale );		// USE ANCHOR IN POSITIONING THE LEGEND CLIENT AREA WITHIN THE BLOCK		// SLACK SPACE		if ( lg.isSetAnchor( ) )		{			final int iAnchor = lg.getAnchor( ).getValue( );			switch ( iAnchor )			{				case Anchor.NORTH :				case Anchor.NORTH_EAST :				case Anchor.NORTH_WEST :					dY = boContainer.getTop( );					break;				case Anchor.SOUTH :				case Anchor.SOUTH_EAST :				case Anchor.SOUTH_WEST :					dY = boContainer.getTop( )							+ boContainer.getHeight( )							- sz.getHeight( );					break;				default : // CENTERED					dY = boContainer.getTop( )							+ ( boContainer.getHeight( ) - sz.getHeight( ) )							/ 2;					break;			}			switch ( iAnchor )			{				case Anchor.WEST :				case Anchor.SOUTH_WEST :				case Anchor.NORTH_WEST :					dX = boContainer.getLeft( );					break;				case Anchor.NORTH_EAST :				case Anchor.EAST :				case Anchor.SOUTH_EAST :					dX = boContainer.getLeft( )							+ boContainer.getWidth( )							- sz.getWidth( );					break;				default : // CENTERED					dX = boContainer.getLeft( )							+ ( boContainer.getWidth( ) - sz.getWidth( ) )							/ 2;					break;			}		}		else		{			dX = boContainer.getLeft( )					+ ( boContainer.getWidth( ) - sz.getWidth( ) )					/ 2;			dY = boContainer.getTop( )					+ ( boContainer.getHeight( ) - sz.getHeight( ) )					/ 2;		}		lg.getBounds( ).set( dX, dY, sz.getWidth( ), sz.getHeight( ) );	}