Professional Documents
Culture Documents
To create an applet, you must import the Applet class That class is in
the java.applet package
The Applet used in java used the class JApplet and using regular Swing GUI
defined in Classes of Jframe.In That classes no constructors used in the program.
// now that all is set we can add these components to the applet
add(okButton);
add(nameField);
add(radio1);
add(radio2);
add(option);
}
}
// Thats's it, you now have given the user visual options.
// However there are no actions related to these comonents.
// You will see that later, first an example of a layoutmanager
// that makes it easier to place components.
// Go to LayoutExample.
Run the program .java in the cmd and make the .class file
Applet Syntax in HTML
The applet tag used in the body of the html that embed the java program in the
html<applet>.
<html>
<head>
</head>
<body>
</body>
</html>
Applet viewer
Html
Applet viewer
The applet viewer where the applet program run on the window. In which
the html file run on the applet viewer and Applet viewer open a new window
and run the class of java
Syntax
The above code of html run in the browser the output will be