.NETJiNi@jigneshdesai.com  
  Home |  .NET<1.0 to 3.5> Forums Blogs |  Other Technologies Skip Navigation Links  | Quiz Contest   dotnetJini Training |   Software Development 
   
Topic : Search Yahoo
Author : Paul k. Total Visits: 240
Published Date: Tuesday, April 18, 2000  

import java.applet.Applet;
import java.awt.*;
import java.net.*;
import java.io.*;

public class SearchYahoo extends Applet {

//--------------------------------------------------------------

TextField searchField;

//--------------------------------------------------------------

public void init() {
Label title = new Label("Enter a string to send to Yahoo");
title.setFont(new Font("Helvetica", Font.BOLD, 18));
title.setBackground(Color.red);
title.setForeground(Color.yellow);
add(title);
add(new Button("Search Yahoo"));
searchField = new TextField(20);
add(searchField);
}

//--------------------------------------------------------------
// Events from *either* Button or TextField should trigger this.

public boolean action(Event event, Object object) {
String searchString = searchField.getText();
if (searchString.equals(""))
searchString = "Java";
Show(searchString);
return(true);
}

//--------------------------------------------------------------

public void Show(String searchString) {
try {
URL yahoo=new URL("http://search.yahoo.com/bin/search?p="
+ searchString);
getAppletContext().showDocument(yahoo);
} catch(Exception e) {
System.out.println("Error: " + e);
}
}
}








 
   
   
   
Add URL | About ME Privacy Policy | Legal Disclaimer

Copyright (C) 2004 -2008 JigneshDesai.com. All rights reserved