OK, but what if you want to be abkle to follow links inside a webpage? Like say for example, go to the "Images" section of Google? Well to do that, you have to use a new kind of listener, a
"HyperlinkListener"
Here's what you do:
add this -- > , HyperlinkListener
after this: implements ActionListener
add this:
Webapalooza.addHyperlinkListener(this);
underneath
Webapalooza.setEditable(false);
add this code block underneath the actionPerformed method:
public void hyperlinkUpdate(HyperlinkEvent evt)
{
if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
{
try
{
Webapalooza.setPage(evt.getURL());
} //end try
catch(IOException ioe)
{ } //end catch
}//end if
} //end hyperlinkEvent
Tuesday, March 31, 2009
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment