到http://java.sun.com/products/java-media/2D/forDevelopers/sdk12print.html

解决方案 »

  1.   

    publicvoidrotateText(Graphicsg,Strings,doubleangle,intx,inty){Graphics2Dg2d=(Graphics2D)g;//Movetheorigintothe(x,y)g2d.translate(x,y);//Rotatetheangleg2d.rotate(Math.PI*(angle/-180));//Drawtextg2d.drawString(s,0,0);//Restoremovingandrotatingg2d.rotate(-Math.PI*(angle/-180));g2d.translate(-x,-y);}要学习更多的Java技术,请到我的CSDN技术专栏:http://www.csdn.net/Author/turbochen
      

  2.   

    sorry,重发一次,刚才是用CSDN助手.net发的,巨不好用:    public void rotateText(Graphics g, String s, double angle, int x, int y)
        {
            Graphics2D g2d = (Graphics2D)g;        // Move the origin to the (x,y)
            g2d.translate(x, y);
            // Rotate the angle
            g2d.rotate(Math.PI*(angle/-180));
            // Draw text
            g2d.drawString(s, 0, 0);
            //Restore moving and rotating
            g2d.rotate(-Math.PI*(angle/-180));
            g2d.translate(-x,-y);
        }