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); }
{
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);
}