By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,468 Members | 1,859 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,468 IT Pros & Developers. It's quick & easy.

JEditorPane, How to get HTML

P: n/a
I have a JEditorPane that I'm filling with a webpage using
JEditorPane.setPage(www.something.com) and it is working fine.

My problem is I want to save the HTML from the page displayed into a
string. I've tried;

String tempString = new String();
tempString = JEditorPane.getText();

This gives me the html for a blank web page.

How can I read the HTML from the page that is displayed in the JEditorPane?

Thanks,
Bernie
Jan 28 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I found the answer. Loading the page with getPage works asyncrounously
so reading the text from the EditorPane may not be valid if the page is
not completed loading. If you set the document to be syncronous, then
the problem goes away.

Bernie

Bernie Hunt wrote:
I have a JEditorPane that I'm filling with a webpage using
JEditorPane.setPage(www.something.com) and it is working fine.

My problem is I want to save the HTML from the page displayed into a
string. I've tried;

String tempString = new String();
tempString = JEditorPane.getText();

This gives me the html for a blank web page.

How can I read the HTML from the page that is displayed in the JEditorPane?

Thanks,
Bernie
Jan 28 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.