Buggy code:
ColorWrap oldColor = g . getColor ( ) ; if ( ( ( ( ( leftFrameThickness ) > 0 ) || ( ( rightFrameThickness ) > 0 ) ) || ( ( upperFrameThickness ) > 0 ) ) || ( ( bottomFrameThickness ) > 0 ) ) { g . setColor ( white ) ; g . fillRect ( 0 , 0 , field . width , upperFrameThickness ) ; g . fillRect ( 0 , upperFrameThickness , leftFrameThickness , field . height ) ; g . fillRect ( ( ( ( field . width ) + 1 ) - ( rightFrameThickness ) ) , upperFrameThickness , ( ( rightFrameThickness ) + ( leftFrameThickness ) ) , ( ( field . height ) - ( bottomFrameThickness ) ) ) ; g . fillRect ( leftFrameThickness , ( ( field . height ) - ( bottomFrameThickness ) ) , ( ( field . width ) - ( rightFrameThickness ) ) , ( ( bottomFrameThickness ) + 1 ) ) ; if ( isBordered ) { g . setColor ( black ) ; g . fillRect ( ( ( ( leftFrameThickness ) - ( borderThickness ) ) + 1 ) , ( ( ( upperFrameThickness ) - ( borderThickness ) ) + 1 ) , ( ( ( ( ( field . width ) - ( leftFrameThickness ) ) - ( rightFrameThickness ) ) + ( 2 * ( borderThickness ) ) ) - 2 ) , borderThickness ) ; g . fillRect ( ( ( ( leftFrameThickness ) - ( borderThickness ) ) + 1 ) , ( ( field . height ) - ( bottomFrameThickness ) ) , ( ( ( ( ( field . width ) - ( leftFrameThickness ) ) - ( rightFrameThickness ) ) + ( 2 * ( borderThickness ) ) ) - 2 ) , borderThickness ) ; g . fillRect ( ( ( ( leftFrameThickness ) - ( borderThickness ) ) + 1 ) , ( ( ( upperFrameThickness ) - ( borderThickness ) ) + 1 ) , borderThickness , ( ( ( ( ( field . height ) - ( upperFrameThickness ) ) - ( bottomFrameThickness ) ) + ( 2 * ( borderThickness ) ) ) - 2 ) ) ; g . fillRect ( ( ( field . width ) - ( rightFrameThickness ) ) , ( ( ( upperFrameThickness ) - ( borderThickness ) ) + 1 ) , borderThickness , ( ( ( ( ( field . height ) - ( upperFrameThickness ) ) - ( bottomFrameThickness ) ) + ( 2 * ( borderThickness ) ) ) - 2 ) ) ; } g . setColor ( oldColor ) ; if ( hasTitle ) { float oldFontSize = g . getFontSize ( ) ; float newFontSize = oldFontSize * 2 ; g . setFontSize ( newFontSize ) ; FontMetricsWrap fm = g . getFontMetrics ( ) ; float height = fm . getHeight ( ) ; float width = fm . stringWidth ( this . title ) ; g . drawString ( this . title , ( ( ( field . width ) // 2 ) - ( width // 2 ) ) , ( ( ( upperFrameThickness ) - 10 ) - height ) ) ; g . setFontSize ( oldFontSize ) ; } Set < String > keySet = mLegendMap . keySet ( ) ; float oldFontSize = g . getFontSize ( ) ; g . setFontSize ( ( oldFontSize * 0.9F ) ) ; FontMetricsWrap fm = g . getFontMetrics ( ) ; float height = fm . getHeight ( ) ; float spacerValue = height * 0.5F ; float xPointer = spacerValue ; float ySpacer = spacerValue ; float rectangleSize = height ; float currentPixelWidth = xPointer ; int legendCnt = 0 ; Timber . d ( "should<seq2seq4repair_space>draw<seq2seq4repair_space>legend<seq2seq4repair_space>now,<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>legend<seq2seq4repair_space>entries:<seq2seq4repair_space>%d" , mLegendMap . size ( ) ) ; for ( String legendName : keySet ) { float stringWidth = fm . stringWidth ( ( "<seq2seq4repair_space>:<seq2seq4repair_space>" + legendName ) ) ; float delta = rectangleSize - height ; ColorWrap color = mLegendMap . get ( legendName ) ; g . setColor ( color ) ; if ( ( ( legendCnt ++ ) != 0 ) && ( ( ( xPointer + ( rectangleSize * 2.0F ) ) + stringWidth ) >= ( field . width ) ) ) { xPointer = spacerValue ; ySpacer += rectangleSize + spacerValue ; } g . fillRect ( xPointer , ySpacer , rectangleSize , rectangleSize ) ; g . setColor ( BLACK ) ; g . drawString ( ( "<seq2seq4repair_space>:<seq2seq4repair_space>" + legendName ) , ( xPointer + rectangleSize ) , ( ySpacer + rectangleSize ) ) ; xPointer += ( rectangleSize * 1.3F ) + stringWidth ; <START_BUG> Timber . d ( "drawing<seq2seq4repair_space>a<seq2seq4repair_space>legend<seq2seq4repair_space>Item:<seq2seq4repair_space>(%s)<seq2seq4repair_space>%d,<seq2seq4repair_space>x:<seq2seq4repair_space>%d<seq2seq4repair_space>,<seq2seq4repair_space>y:<seq2seq4repair_space>%d" , legendName , legendCnt , ( xPointer + rectangleSize ) , ( ySpacer + rectangleSize ) ) ; <END_BUG> } g . setFontSize ( oldFontSize ) ; g . setColor ( BLACK ) ; } for ( Drawable onFrameDrawing : onFrameDrawables ) { onFrameDrawing . paint ( g ) ; } } private void prepareDrawables ( ) { } public double [ ] getxRange ( ) { } public void setxRange ( double [ ] xRange ) { } public double [ ] getyRange ( ) { } public void setyRange ( double [ ] yRange ) { } public float [ ] getFrameThickness ( ) { } public void setFrameThickness ( float leftFrameThickness , float rightFrameThickness , float upperFrameThickness , float bottomFrameThickness ) { } public void setBorderThickness ( float borderThickness ) { } public void setBorder ( ) { } public void unsetBorder ( ) { } public boolean isOnFrame ( ) { } public double ticsCalcX ( float pixelDistance , RectangleWrap field ) { } public double ticsCalcY ( float pixelDistance , RectangleWrap field ) { } public void setTitle ( String title ) { } public boolean isMultiMode ( ) { }

Fix:
Timber . d ( "drawing<seq2seq4repair_space>a<seq2seq4repair_space>legend<seq2seq4repair_space>Item:<seq2seq4repair_space>(%s)<seq2seq4repair_space>%d,<seq2seq4repair_space>x:<seq2seq4repair_space>%,.2f<seq2seq4repair_space>,<seq2seq4repair_space>y:<seq2seq4repair_space>%,.2f" , legendName , legendCnt , ( xPointer + rectangleSize ) , ( ySpacer + rectangleSize ) ) ;