Write an applet that can interact with both the HTTP client and HTML interpreter in a browser.
import java.applet.*;
import java.net.*; // import packages //
import java.awt.*;
public class buttons extends Applet {
public void init ( ) {
add(new Button{"Yin"});
add(new Button{"Yang"});
}
public Boolean action(Event e, Object arg) {
if (( ( Button) e. target).getLabel( ) == "Yin") {
try {
getAppletContext( ).showDocument(new
URL(http: / /www.expertsminds.com/yin();
}
catch(Exception ex) {
/ / catch block is used for Handle the exception handling / /
}
}
else if (( (Button) e. target) .getLabel ( ) == "Yang") {
try {
getAppletContext ( ).showDocument(new
URL(http: / /www.expertsminds.com/yang( );
}
catch(Exception ex) {
/ / try block is used for Handle the exception handling / /
}
}
return true;
}
}