本文介绍了JTextPane不包装文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到了一个奇怪的问题。我在JscrollPane中有一个JtextPane,它在分发列表中显示大字符串,并且在我使用eclipse运行程序时正确包装代码但是当我在使用java webstart运行相同程序时它停止包装文本。你能告诉我该怎么办。这是代码。
I am running into one weird problem. I have a JtextPane inside a JscrollPane which is showing large string in term of distribution list and it is properly wrapping code when I am running the program using eclipse but when I am running the same program in using java webstart it stopped wrapping the text. Could you please tell me what should I do. Here is the code.
private JScrollPane displayResults(String distributionList) {
// TODO Auto-generated method stub
JTextPane textArea = new JTextPane();
textArea.setText(distributionList);
textArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(textArea);
scrollPane.setPreferredSize( new Dimension( 500, 500 ) );
return scrollPane;
}
推荐答案
原因可能是java版。
The reason could be java version.
参见讨论并提供解决方法
See https://forums.oracle.com/forums/thread.jspa?messageID=10690405 where it is discussed and a workaround is provided
这篇关于JTextPane不包装文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!