Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

New to swing ... JTextPane blocking  RSS feed

 
Paulo Faria
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I'm trying to make an application that reads text files in various formats
(html, rtf, pdf). In the following code the TextContainer object is a subclass of JTextPane made for modifying the default editorkit (for modifying the viewfactory)

The problem is that this code blocks without displaying the JTextPanes. I've isolated the problem by commenting something to occur when i use the setDocument method after parsing the file to an intermediate format. Before i was using an JEditorPane, that DID display the text, but afterwards when i tried to modify the viewfactory also blocked. I've also tried to use a runnable to run the setdocument methods but it didn't work either.

Please ... help!

 
Paulo Faria
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've since realized that the problem is the document i'm feeding the JTextPane. If i treat it as plain text, the JTextPane displays it, If i feed it styledtext it blocks.

I'm posting my document generating code in hope that someone has a solution

The callback receives a styledocument that is populated as the html parser reads tags. Trying to read a larger file and displaying it as styled text blocks jtextPane and JEditorPane.



if i replace
doc.insertString(end, new String(text), memory);
for
doc.insertString(end, new String(text), null);

and erase
doc.setCharacterAttributes(end,doc.getLength(),memory,false);

in handleText(char[] text, int position) it displays the text indicating that it is the styled text that is making the jTextPane block.

[ February 11, 2006: Message edited by: Paulo Faria ]
[ February 11, 2006: Message edited by: Paulo Faria ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!