Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I load search results into my applet?

 
Billy Sclater
Ranch Hand
Posts: 145
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My goal is to have an applet that #1 searches Yahoo, and then #2 displays the search results in the applet itself.

I am playing with 2 classes from this site: http://www.apl.jhu.edu/~hall/java/CGI-with-Java.html
SearchService.java and SearchYahoo.java.

#1 is taken care of, what it does is displays a textfield,
on entering my search into the textfield and clicking the button, the applet goes directly to Yahoo.com
and displays the search results.

Does anyone know a way to display the results in the directly into the applet itself in a small window?


 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One possible way to do it would be have a JEditorPane embedded in your applet which you load with the yahoo query page.
Another would be to explore if yahoo exposes a search API which returns JSON or XML or any other format which your applet can consume. Then parse the data and display in whatever way you wish. Of course you will have to overcome the sandbox restriction, because "an applet can only dial home"
 
Billy Sclater
Ranch Hand
Posts: 145
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JEditorPane solution sounds like the easiest way.
But, I'd like to be able to display 'clickable' links in the applet. I suppose I could also use openStream() and parse the data to retrieve 4 or 5 links. Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic