在JTextpane中切换文本换行 [英] Toggling text wrap in a JTextpane
本文介绍了在JTextpane中切换文本换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何在 JTextpane
上切换文本换行?
How would I go about toggling text wrap on a JTextpane
?
public JFrame mainjFrame = new JFrame("Text Editor");
public JTextPane mainJTextPane = new JTextPane();
public JScrollPane mainJScrollPane = new JScrollPane(mainJTextPane);
mainjFrame.add(mainJScrollPane);
推荐答案
参见 No Wrap Text Pane 。
编辑:
好吧,如果你想切换行为,那么你还需要切换getScrollableTracksViewportWidth()值。请参见可滚动面板。你应该能够在FIT和STRETCH之间切换。
Well, if you want to toggle the behaviour, then you would also need to toggle the getScrollableTracksViewportWidth() value. See Scrollable Panel. You should be able to toggle between FIT and STRETCH.
这篇关于在JTextpane中切换文本换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文