Getting the Dimensions of Text:获取文本的长和宽
来源:互联网 发布:mac电脑照片怎么整理 编辑:程序博客网 时间:2024/04/29 06:36
// From within the paint() method.
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D)g;
Font font = new Font("Serif", Font.PLAIN, 12);
FontMetrics fontMetrics = g2d.getFontMetrics();
int width = fontMetrics.stringWidth("aString");
int height = fontMetrics.getHeight();
}
// From within a component.
class MyComponent extends JComponent {
MyComponent() {
Font font = new Font("Serif", Font.PLAIN, 12);
FontMetrics fontMetrics = getFontMetrics(font);
int width = fontMetrics.stringWidth("aString");
int height = fontMetrics.getHeight();
}
}
- Getting the Dimensions of Text:获取文本的长和宽
- Getting the dimensions of the soft keyboard
- 获取Text文本的高度和宽度
- 获取peergroup的所有peers(Getting a list of the peers in a PeerGroup)
- 用js分别获取select的value 和 text 文本
- TreeView 获取选中的Value和Text文本,下面只能获取文本
- 获取自定义View中Text文本的实际宽高
- UGUI Text组件实际文本宽高的获取
- 获取物料、采购长文本的方法
- ABAP 自己定义一个长文本TEXT的编写、保存
- 获取Gridview的HyperLinkField的Text文本
- 获取Gridview的HyperLinkField的Text文本
- Getting the hang of IOPS
- 获取下拉菜单的项文本 text
- 获取图片的长和宽
- python中关于Np.hstack()错误的ValueError: all the input arrays must have same number of dimensions
- Jquery 获取选中的Select的Text文本值和Value值。
- SAP long text SAP长文本读取。
- [转]关于TUXEDO 负载均衡和MSSQ的探讨
- WPF布局
- ASP.NET绑定学习
- AJAX+Js实现html页面点击数自动更新
- 下载
- Getting the Dimensions of Text:获取文本的长和宽
- Sybase 代替start with、connect by的store procedure
- 静态资源(StaticResource)和动态资源(DynamicResource)
- 靳氏DIV布局兼容“武林秘诀”
- BSD net源码分析(1)
- Java的SCWCD认证考什么(含真题以及考点分析)
- [AutoIt]发送SMTP邮件,支持附件
- WPF体系结构
- Magento设计人员手册