• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is this possible in JEditorPane

 
arun mahajan
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I ws making a standalone applicaion in swing and using the JEditorPane for showing some of my HTML. I was able to show the HTML which is already exists in my local computer or at some other URL. I have to make the HTML dynamicaaly at run time in the program. Is it possible to show this run time HTML in JEditorPane, as I am not able to find any alternative for the URL it has to use to show the HTML.
Is it possible? can you help me?
regards,
Arun
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure you can generate HTML in your program and show it in a JEditorPane... All you have to do is make sure and set the content type of the JEditorPane to "text/html" so it knows to parse your HTML, and then just pass the HTML to the JEditorPane with a call to setText().

Here is an example... Some dynamic HTML gets generated every second to show the current time and is displayed in the JEditorPane...


-Nate
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!