Wrapping HTML text in a JEditorPane inside a JScrollPane

余生长醉 提交于 2019-11-29 02:42:37
// JPanel panel = new JPanel();
ScrollablePanel panel = new ScrollablePanel();
panel.setScrollableWidth( ScrollablePanel.ScrollableSizeHint.FIT );

See Scrollable Panel for the class and an explanation on how the class works.

The scrollbars of a JScrollPane appear if the size of the viewport become smaller than the preferred size of its view component. Set the preferred size of the panel in the scroll pane, or set the preferred size of each of the editor panes : the preferred size of the panel will be the composition of the preferred sizes of the editor panes (sum of the preferred height, and max of the preferred widths)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!