Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
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
Forums:
Java in General
Swing / AWT / SWT
Load a RTF with an image in it to a JTextPane
Dragoi Nicolae
Greenhorn
Posts: 2
posted 7 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,I want to load a
RTF
file with an image and text in it to a JTextPane. The problem is that only the text gets sent not the image.
Heres what I tried :
private static final RTFEditorKit RTF_KIT = new RTFEditorKit(); (...) text.setContentType("text/rtf"); inputStream = new FileInputStream(filename); DefaultStyledDocument styledDocument = new DefaultStyledDocument(new StyleContext()); RTF_KIT.read(inputStream, styledDocument, 0); text.setDocument(styledDocument);
Thanks in advance :P
Campbell Ritchie
Marshal
Posts: 79151
377
posted 7 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Welcome to the Ranch
Does a text pane support images? I always thought it would support text only, but I might be mistaken. Have a look in the
Java™ Tutorials
.
Tim Moores
Saloon Keeper
Posts: 7582
176
posted 7 years ago
1
Number of slices to send:
Optional 'thank-you' note:
Send
RTFEditorKit is quite limited, although you wouldn't know it from the javadocs. It's also buggy and hasn't seen improvements in many years. You can try
http://java-sl.com/advanced_rtf_editor_kit.html
instead, which does support images.
Dragoi Nicolae
Greenhorn
Posts: 2
posted 7 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hey ,
@Campbell Ritche , it does support images .
@Tim Moores ,I will try , thanks.Didnt realize it doesnt support images.
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Problem using RTFEditorKit to make a WordProcessor Like WordPad in Windows
Problem using RTFEditorKit
Writing RTF files from Java Swing DefaultStyledDocuments
Webpage not opening inside jeditorpane
JTextPane
More...