• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

New to swing ... JTextPane blocking

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic