Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

repainting problems...

 
Venkat Injapury
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have problem with the JEditorpane control. I am using the JEditorPane for displaying the html page. I am dynamically generating .jpg file in put into a html page, and this html page is showing it at JEditorPane. every thing is working fine except i am not able to refresh the image is called .jpg is not showing current .jpg, it means not refreshing the compnent.
Here is my code below....
===============================
JEditorPane editPane = new JEditorPane();
editPane.setEditable(false);
editPane.setContentType("text/html");
editPane.setEditorKit(new HTMLEditorKit());
try{
URL sFile = new URL("file://c:\temp\sample.html");
editPane.setPage(sFile);
editPane.updateUI();
editPane.invalidate();
editPane.repaint();
}catch(Exception ioe){
ioe.printStackTrace();
}
=============
Could any body suggest/help to refresh JEditorPane component for each instance.. I am extending this class with JFrame and is calling from another parent window which is also extended with JFrame.
Thans in advance.
Venkat
 
Joe Gilvary
Ranch Hand
Posts: 152
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably need to read the page again to force
the app to read the latest version of your graphic.
The layout displays the graphic that is in memory,
i.e., the graphic the app originally read.
HTH,
Joe
 
Venkat Injapury
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe,
You are right! But the thing is I have a html comtent in that page, that portion is displaying properly, the graphic portion only not displaying, it mean the old graphics is comming every time. I did the double time loading the url with setPage("c:\blah.."), is this right way of doing this is there any way to load the page again. I heard that double buffering, i don't know what exactly double buffering, Can any body suggest how can i refresh the image in the JEditorPane in each instance.
any kind of code and suggestions appreciated.
Thanks,
venkat
 
Joe Gilvary
Ranch Hand
Posts: 152
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean that you update the HTML and see the change
but update the JPG at the same time and do not see
that change?
Thanks,
Joe
 
Venkat Injapury
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe,
Thanks for your immediate reply. Yah, that is true what you understand.
thanks,
Venkat
 
Joe Gilvary
Ranch Hand
Posts: 152
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's in the Bug Parade at the JDC site. The work
around listed there doesn't seem to help for the
graphics.
http://developer.java.sun.com/developer/bugParade/bugs/4492274.html
Thanks,
Joe
 
Venkat Injapury
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe,
Thanks for your help! As the document describes i am always passing the same url, the html content are deffers, the graph that is .jpg file is generating my program dynamically.
Thanks for you help.
Thanks,
Venkat
 
NILESH PATEL
Ranch Hand
Posts: 71
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have any comment against the postings, but just wondering how you are creating .jpg file using java or something else on the fly. That may be useful to me, as I want to create a xsl transformation of xml data to html and then display numeric data in graph/piechart form or something. In this case I may have to generate .jp or .gif image first.
Please let me know if you can, on how to create image on the fly.
my email is: jayagnesh786@hotmail.com
Thanks
Nilesh
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic