The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.awt  [78 examples] > Text  [3 examples]

e592. Drawing Rotated Text

    // Draw string rotated clockwise 90 degrees
    AffineTransform at = new AffineTransform();
    at.setToRotation(Math.PI/2.0);
    g2d.setTransform(at);
    g2d.drawString("aString", x, y);
    
    // Draw string rotated counter-clockwise 90 degrees
    at = new AffineTransform();
    at.setToRotation(-Math.PI/2.0);
    g2d.setTransform(at);
    g2d.drawString("aString", x, y);

 Related Examples
e591. Drawing Simple Text
e593. Getting the Dimensions of Text

See also: Colors    Components    Containers    Cursors    Drawing    Events    Focus    Frames    GridBagLayout    Images    Shapes    Simulating Events    The Screen   


© 2002 Addison-Wesley.