Wrapping/Rotating text on a image using graphics2D
<pre><code>void multiLine (int x, int y, String label, Graphics2D g) {

    AffineTransform fontAT = new AffineTransform();
    Font theFont = g.getFont();
    fontAT.rotate(-Math.PI / 2);
    Font theDerivedFont = theFont.deriveFont(fontAT);
    g.setFont(theDerivedFont);

    AttributedString attrStr = new AttributedString(label);
    // Get iterator for string:
    AttributedCharacterIterator characterIterator = attrStr.getIterator();

    // Get font context from graphics:
    FontRenderContext fontRenderContext = g.getFontRenderContext();

    // Create measurer:
    LineBreakMeasurer measurer = new LineBreakMeasurer(characterIterator,
            fontRenderContext);

    while (measurer.getPosition() &lt; characterIterator.getEndIndex()) {
        TextLayout textLayout = measurer.nextLayout(200);
        y += textLayout.getAscent(); //Have tried changing y to x
        textLayout.draw(g, x, y);

        y += textLayout.getDescent() + textLayout.getLeading(); //Have tried changing y to x
    }
    g.setFont(theFont);

}
</code></pre>

<p>I am expecting this to print lines vertically but it does not , any ideas about how can I resolve this. </p>

<p>This outputs texts horizontally wrapped.</p>

<p>Edit: Changed the question to correctly reflect what I am trying to achieve</p>
