In this question, the inquirer says
The JTextPane do have word wrap when text exceeded width
This does not seem to be the case.
scrollPane = new JScrollPane();
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
this.contentPane.add(scrollPane);
txtrFghj = new JTextPane();
txtrFghj.setBorder(null);
txtrFghj.setContentType("text/html");
txtrFghj.setText(content);
scrollPane.setViewportView(txtrFghj);
In the given code excerpt, content
's content will not wrap at all, it simply exceedes the visible size of the window. Long sentences cannot be seen completely, if the window is not big enough.
How can I achieve line wrapping?
I tried
txtrFghj.setSize(50,50);
but this does not change any behaviour at all.