字体大小更改后自动调整 JtextPane 大小
我在 JTextPane
中加载文本,并且每行自动获取其所能容纳的最大字数。当我减小 Font
大小时,文本就会缩小,并且所有行都是半空的。如何自动调整文本大小,以便无论我使用什么大小的 Font
都填充每一行? 更改字体的代码是
JComboBox cb =(JComboBox)evt.getSource();
String Selection =(String)cb.getSelectedItem();
int n = Integer.parseInt(Selection);
Font font = new Font("Monospaced", Font.PLAIN, n);
editPane.setFont(font);
I load a text in a JTextPane
and automatically every line takes the max number of words it can. When I decrease the Font
size text just zoom out and all lines are half empty. How can I auto resize the text so every line is filled no matter what size of Font
I use?
The code for changing font is
JComboBox cb =(JComboBox)evt.getSource();
String Selection =(String)cb.getSelectedItem();
int n = Integer.parseInt(Selection);
Font font = new Font("Monospaced", Font.PLAIN, n);
editPane.setFont(font);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论