Steps for Creating and Running the Swing Applet
The folder view of the project is shown in the below image.
Step 1: First, create the file as SApplet.java and enter the code into it.
Step 2: Once the code is been inserted then we need to create the SApplet.html file, through which we will display the output.
HTML
<!DOCTYPE html> < html > < head > < title >Java Applet Example</ title > </ head > < body > < applet code = "SApplet.class" width = 220 height = 90 > No Support </ applet > </ body > </ html > |
Step 3: Then we need to compile the Java code using the below command:
javac SApplet.java
Step 4: Now finally we need to run the application using the below power:
appletviewer SApplet.html
How to Use Swing Applet in Java?
In this article, we will be using the swing Applet or JApplet in Java. Here, we will make a simple multiplication application that will multiply the two input numbers.