*
The moose likes Swing / AWT / SWT and the fly likes repainting problems... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "repainting problems..." Watch "repainting problems..." New topic
Author

repainting problems...

Venkat Injapury
Greenhorn

Joined: May 24, 2001
Posts: 11
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

Joined: May 11, 2001
Posts: 152
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

Joined: May 24, 2001
Posts: 11
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

Joined: May 11, 2001
Posts: 152
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

Joined: May 24, 2001
Posts: 11
Hi Joe,
Thanks for your immediate reply. Yah, that is true what you understand.
thanks,
Venkat
Joe Gilvary
Ranch Hand

Joined: May 11, 2001
Posts: 152
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

Joined: May 24, 2001
Posts: 11
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

Joined: Nov 21, 2000
Posts: 71
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: repainting problems...
 
Similar Threads
write html in jsp
retrieving string from a webpage
getOutputStream() has already been called for this response
display web page
JEditorPane Refresh