java 绘画文字旋转Graphics2D.drawString

Graphics2D g2 = (Graphics2D) g;
Font font = new Font(null, Font.PLAIN, 10);    
AffineTransform affineTransform = new AffineTransform();
affineTransform.rotate(Math.toRadians(45), 0, 0);
Font rotatedFont = font.deriveFont(affineTransform);
g2.setFont(rotatedFont);
g2.drawString("A String",0,0);
g2.dispose();

你可能感兴趣的:(java,java,Graphics2D)