当前位置: 技术问答>java相关
请问drawString 如何将字符串竖派,而不是横放,谢谢!
来源: 互联网 发布时间:2015-07-29
本文导语: 请问drawString 如何将字符串竖派,而不是横放,谢谢! | public void paint(Graphics g){ Graphics2D g2 = (Graphics2D)g; g2.rotate(Math.PI/2, 200, 200); g2.drawString("Hello, world!", 200, 200); } --- ZJQ | ...
请问drawString 如何将字符串竖派,而不是横放,谢谢!
|
public void paint(Graphics g){
Graphics2D g2 = (Graphics2D)g;
g2.rotate(Math.PI/2, 200, 200);
g2.drawString("Hello, world!", 200, 200);
}
--- ZJQ
Graphics2D g2 = (Graphics2D)g;
g2.rotate(Math.PI/2, 200, 200);
g2.drawString("Hello, world!", 200, 200);
}
--- ZJQ
|
Graphics2D g2 = (Graphics2D)g;
g2.rotate(Math.PI/2, 100, 100);
g2.drawString("Hello, world!1111", 100, 100);//转90度,竖放
g2.rotate(Math.PI*3/2, 130, 130);
g2.drawString("Hello, world!2222", 130, 130);//再转270度,横放
g2.rotate(Math.PI/2, 100, 100);
g2.drawString("Hello, world!1111", 100, 100);//转90度,竖放
g2.rotate(Math.PI*3/2, 130, 130);
g2.drawString("Hello, world!2222", 130, 130);//再转270度,横放
|
Graphics2D里的rotate()