@Override
    public void drawString(AttributedCharacterIterator iterator, float x, 
            float y) {
        Set<Attribute> s = iterator.getAllAttributeKeys();
        if (!s.isEmpty()) {
            TextLayout layout = new TextLayout(iterator, 
                    getFontRenderContext());
            layout.draw(this, x, y);
        } else {
            StringBuilder strb = new StringBuilder();
            iterator.first();
            for (int i = iterator.getBeginIndex(); i < iterator.getEndIndex(); 
                    i++) {
                strb.append(iterator.current());
                iterator.next();
            }
            drawString(strb.toString(), x, y);
        }
    }
@Override
    public void drawString(AttributedCharacterIterator iterator, float x, 
            float y) {
        Set<Attribute> s = iterator.getAllAttributeKeys();
        if (!s.isEmpty()) {
            TextLayout layout = new TextLayout(iterator, 
                    getFontRenderContext());
            layout.draw(this, x, y);
        } else {
            StringBuilder strb = new StringBuilder();
            iterator.first();
            for (int i = iterator.getBeginIndex(); i < iterator.getEndIndex(); 
                    i++) {
                strb.append(iterator.current());
                iterator.next();
            }
            drawString(strb.toString(), x, y);
        }
    }
@ Override public void drawString ( AttributedCharacterIterator iterator , float x , float y ) { Set < Attribute > s = iterator . getAllAttributeKeys ( ) ; if ( ! s . isEmpty ( ) ) { TextLayout layout = new TextLayout ( iterator , getFontRenderContext ( ) ) ; layout . draw ( this , x , y ) ; } else { StringBuilder strb = new StringBuilder ( ) ; iterator . first ( ) ; for ( int i = iterator . getBeginIndex ( ) ; i < iterator . getEndIndex ( ) ; i ++ ) { strb . append ( iterator . current ( ) ) ; iterator . next ( ) ; } drawString ( strb . toString ( ) , x , y ) ; } }
Draws a string of attributed characters at {@code (x, y)}.

@param iterator  an iterator over the characters ({@code null} not
permitted).
@param x  the x-coordinate.
@param y  the y-coordinate.
Draws a string of attributed characters at { @code ( x y ) } .