I have JTextPane with HTML like this
pane.setContentType("text/
html");
try
{
StyledDocument doc = (StyledDocument)pane.getDo
cument();
Style style = doc.addStyle("StyleName", null);
StyleConstants.setFontFami
ly(style, "Palatino Linotype");
StyleConstants.setFontSize
(style, 15);
StyleConstants.setForegrou
nd(style, Color.RED);
doc.insertString(doc.getLe
ngth(), "Test fjkd sdfhsdjfhds hdsifh dsjifh hdfsjidhfjid shshfsdhf hfishf h", style);
StyleConstants.setForegrou
nd(style, Color.BLACK);
doc.insertString(doc.getLe
ngth(), "Test ", style);
StyleConstants.setForegrou
nd(style, Color.BLUE);
doc.insertString(doc.getLe
ngth(), "Test ", style);
StyleConstants.setForegrou
nd(style, Color.GREEN);
doc.insertString(doc.getLe
ngth(), "Test ", style);
StyleConstants.setForegrou
nd(style, Color.YELLOW);
doc.insertString(doc.getLe
ngth(), "Test ", style);
StyleConstants.setForegrou
nd(style, Color.GRAY);
doc.insertString(doc.getLe
ngth(), "Test ", style);
StyleConstants.setForegrou
nd(style, Color.CYAN);
doc.insertString(doc.getLe
ngth(), "Test ", style);
StyleConstants.setForegrou
nd(style, Color.MAGENTA);
doc.insertString(doc.getLe
ngth(), "Test ", style);
StyleConstants.setForegrou
nd(style, Color.ORANGE);
doc.insertString(doc.getLe
ngth(), "Test ", style);
StyleConstants.setForegrou
nd(style, Color.PINK);
doc.insertString(doc.getLe
ngth(), "Test ", style);
}
catch(Exception e)
{
}
How can DO LineWrap for this??
Start Free Trial