java计算字符串的宽度和高度

//g对象为一个Graphics
FontMetrics fm = g.getFontMetrics ();          
int strWidth = fm.stringWidth ("Registering plug-ins……");          
int strHeight = fm.getHeight ();  

转载:http://sbje5201314.blog.163.com/blog/static/280338620086332426488/

原文地址:https://www.cnblogs.com/luckystar2010/p/4157557.html