Advertisement

10.16.2007 at 02:35AM PDT, ID: 22895573
[x]
Attachment Details

Line Wrap in JTextPane

Asked by sangameshrh in Java AWT & Swing, Java Programming Language

Tags: wrap, jtextpane, line

I have JTextPane with HTML like this

pane.setContentType("text/html");
try
{
      StyledDocument doc = (StyledDocument)pane.getDocument();
      Style style = doc.addStyle("StyleName", null);
      
      StyleConstants.setFontFamily(style, "Palatino Linotype");
      StyleConstants.setFontSize(style, 15);
      StyleConstants.setForeground(style, Color.RED);
      doc.insertString(doc.getLength(), "Test fjkd sdfhsdjfhds hdsifh dsjifh hdfsjidhfjid shshfsdhf hfishf h", style);
      
      StyleConstants.setForeground(style, Color.BLACK);
      doc.insertString(doc.getLength(), "Test ", style);
      
      StyleConstants.setForeground(style, Color.BLUE);
      doc.insertString(doc.getLength(), "Test ", style);
      
      StyleConstants.setForeground(style, Color.GREEN);
      doc.insertString(doc.getLength(), "Test ", style);
      
      StyleConstants.setForeground(style, Color.YELLOW);
      doc.insertString(doc.getLength(), "Test ", style);
      
      StyleConstants.setForeground(style, Color.GRAY);
      doc.insertString(doc.getLength(), "Test ", style);
      
      StyleConstants.setForeground(style, Color.CYAN);
      doc.insertString(doc.getLength(), "Test ", style);
      
      StyleConstants.setForeground(style, Color.MAGENTA);
      doc.insertString(doc.getLength(), "Test ", style);
      
      StyleConstants.setForeground(style, Color.ORANGE);
      doc.insertString(doc.getLength(), "Test ", style);
      
      StyleConstants.setForeground(style, Color.PINK);
      doc.insertString(doc.getLength(), "Test ", style);
}
catch(Exception e)
{
}

How can DO LineWrap for this??Start Free Trial
[+][-]10.16.2007 at 02:53AM PDT, ID: 20084167

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java AWT & Swing, Java Programming Language
Tags: wrap, jtextpane, line
Sign Up Now!
Solution Provided By: objects
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628