• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

JEditorPane / JTextPane, I/O with text and images

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not new to Java, but have been studying other things for a while.

What I want to do, is take a project I created before, that used only text, and change it so it will be able
to load both images and text together into the JEditorPane or JTextPane from a file, edit it by adding text
or images, and then be able to save it.

The formats I am interested in working with are RTF, HTML, and plain text. What I would like to find out is:

1. Should I use JEditorPane or JTextPane? (Considering that I want to work with RTF, HTML, and plain text)

2. How would I go about combining the text and image in one file . . . . or do they have to be separate?

3. Do you know of any tutorials on the internet that show how to implement this?
 
Marshal
Posts: 68855
275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Start with the Java™ Tutorials. Go through the whole of that “trail” and you will find more about editor panes. See what you can find out about document listeners and key bindings too.
 
Shawn Irwin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not plan on making a study of Java at the moment, just to accomplish what I asked about; I am currently studying
for my CCNA, I do not have time currently to read the whole study path to accomplish what I am asking about . . . . .
If I had that much time, I would not bother asking, I would gladly go through the tutorials, every one of them. So now
you understand why I am asking.
 
Campbell Ritchie
Marshal
Posts: 68855
275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I meant that you could restrict your attention to those sections with editor pane in their titles.
 
Shawn Irwin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here I am going to attempt answer my own questions for those who have similar issues.

The formats I am interested in working with are RTF, HTML, and plain text. What I would like to find out is:

1. Should I use JEditorPane or JTextPane? (Considering that I want to work with RTF, HTML, and plain text)

It appears that both support all three. What I found out though, is making the decision regarding which one to
use might best be done by trying each one, as all you have to do is patch one type in, set its name to whatever
you had the original set to, and you should be ready to run it an try it out. One of them had a bad issue with
word wrap not working when you had a long sentence, so watch out, I do not recall which one it was.


2. How would I go about combining the text and image in one file . . . . or do they have to be separate?
This question I have yet to answer, although my suspicion is that it will need to be stored as one binary-format file.

3. Do you know of any tutorials on the internet that show how to implement this?
http://docs.oracle.com/javase/tutorial/uiswing/components/editorpane.html
https://www.youtube.com/watch?v=gfjqCD-akv4
http://docs.oracle.com/javase/tutorial/uiswing/components/textarea.html

I also searched forums, and found a few things that were helpful there.

 
machines help you to do more, but experience less. Experience this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic