Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在我的软件中添加打印功能,这需要压缩不适合它们在文本框中的文本(字母不应垂直收缩)。
使用标准的 java 方法可以做到这一点,还是有人知道好的扩展?
我想要附上图片上的文字
谢谢!
您可以尝试覆盖paintComponent()并将水平比例应用于Graphics实例
paintComponent()
Graphics
Graphics2D g2d=(Graphics2D)g; AffineTransform old=g2d.getTransform(); g2d.scale(0.5, 1); //paint the text here g2d.setTransform(old);