Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Making a browser  RSS feed

 
James Palmer
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, basically i have a text field and a JEditorPane.What i want is to input an address in the text field and make the web page come up in the JEditorPane.I have this code so far(tfAddress is the variable name for the textfield).
tfAddress.addActionListener(new ActionListener()) {
public void ActionPerformed(ActionEvent ae){ //does something when enter is pressed
field.getText()
}
}
How can i make the JEditorPane display the page?(you can probably understand that am not very good with java yet as this is probably a bit of a silly question)
Thanks to everyone who helps with this.
 
KR Campbell
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Firstly you will need a java.net.URL.
Put your address in here from your textField.
Put your JEditorPane in a JFrame or some other means of displaying it.
e.g.

Then use

to get the web page content, format and display it.
Don't forget to handle exception MalformedURLException in your URL constructor.
Regards,
Ken
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!