public void paint ( Graphics g ) { if ( gridLines != null ) { if ( gridVisible ) { for ( int i = 0 ; i < gridLines . length ; i ++ ) { for ( int j = 1 ; j < gridLines [ i ] . length - 1 ; j ++ ) { gridLines [ i ] [ j ] . paint ( g ) ; } } } if ( frameVisible ) { for ( int i = 0 ; i < gridLines . length ; i ++ ) { gridLines [ i ] [ 0 ] . paint ( g ) ; gridLines [ i ] [ gridLines [ i ] . length - 1 ] . paint ( g ) ; } } } if ( labelVisible ) { if ( gridLabels != null ) { int [ ] xy = g . projection . screenProjection ( gridLabels [ 1 ] . getCoordinate ( ) ) ; int prevx = xy [ 0 ] ; int prevy = xy [ 1 ] ; for ( int i = 0 ; i < gridLabels . length ; i ++ ) { if ( ! gridLabels [ i ] . text . isEmpty ( ) ) { double [ ] coord = gridLabels [ i ] . getCoordinate ( ) ; xy = g . projection . screenProjection ( coord ) ; int x = xy [ 0 ] ; int y = xy [ 1 ] ; if ( base . getDimension ( ) == 2 && index == 0 && rotation != 0.0 ) { if ( ( prevx == x && prevy == y ) || Math . abs ( x - prevx ) > gridLabels [ i ] . font . getSize ( ) ) { gridLabels [ i ] . paint ( g ) ; prevx = x ; prevy = y ; } } else if ( base . getDimension ( ) == 2 && index == 1 ) { if ( ( prevx == x && prevy == y && i == 0 ) || Math . abs ( prevy - y ) > gridLabels [ i ] . font . getSize ( ) ) { gridLabels [ i ] . paint ( g ) ; prevx = x ; prevy = y ; } } else { if ( ( prevx == x && prevy == y ) || Math . abs ( x - prevx ) > g . g2d . getFontMetrics ( gridLabels [ i ] . font ) . stringWidth ( gridLabels [ i ] . text ) || Math . abs ( prevy - y ) > gridLabels [ i ] . font . getSize ( ) ) { gridLabels [ i ] . paint ( g ) ; prevx = x ; prevy = y ; } } } } } if ( axisLabel != null ) { axisLabel . paint ( g ) ; } } }
Draw the axis .