What is Applet in Java with Example?

In this section we are explaining you the Applet concept and you will understand What is Applet in Java with Example code?

What is Applet in Java with Example?

In this section we are explaining you the Applet concept and you will understand What is Applet in Java with Example code?

What is an Applet

What is Applet in Java with Examples?

In this section we are going to learn the Applet in Java. In Java Applet are special Java program that runs on the Java enabled web browser. Applet allows the developer to create GUI application using the Swing components. This makes applet just like desktop application that runs on the browser.

Applet program is hosted on the web server and its jar file is downloaded form the server before running in the Java Enabled web browser. Applet can be used to create various types of applications including animation applets.

Applet program can be signed with the cryptography keys to make it secure. There are restriction on the Applet as it is downloaded from the internet and requires to be compliant with Internet security standard.

Introduction

Applet is Java program and its jar files are distributed from the web sever, it is embedded into HTML page and runs on the web broser. Java applets runs on the java enables web browsers such as mozila and internet explorer. Applet is designed to run remotely on the client browser, so there are some restrictions on it. Applet can't access system resources on the local computer. Applets are used to make the web site more dynamic and entertaining.

You can create Applet by extending your class with Applet class. Here is simple example of Hello World applet:

import java.applet.*;
import java.awt.*;

public class FirstApplet extends Applet{
  public void paint(Graphics g){
  g.drawString("Welcome in Java Applet.",40,20);
  }
}

You have to compile this class into a class file and then embedded in HTML page. Check Creating First Applet for quick example of coding, compiling and running an Applet.

To run Applet in browser you have you use Java enabled web browser. Here are examples of Applet:

  1. What is Applet
  2. Applet versus Application
  3. Understanding Applet Life Cycle
  4. Creating First Applet
  5. Drawing Shapes
  6. Drawing Shapes using color
  7. Event Listeners
  8. Passing Parameters To Applet
  9. Opening a URL from an Applet
  10. Opening new browser window from an Applet
  11. Applet not working error
  12. Applet Read File Example
  13. Applet Write Files Example
  14. Display image in the applet
  15. Play sound in applet
  16. Applet Security - Understanding applet security
  17. Swing applet Example
  18. Applet Banner
  19. Clock Applet
  20. Java - Opening a url in new window from an applet
  21. Java - Opening a URL from an Applet

In this section we have provided you many example of Applet in Java.

Tutorials

  1. What is an Applet
  2. The Life cycle of An Applet
  3. Java Applet - Creating First Applet Example
  4. Java - Drawing Shapes Example in java
  5. Java - Drawing Shapes Example using color in java
  6. Java - Event Listeners Example in Java Applet
  7. Applet - Passing Parameter in Java Applet
  8. Opening a URL from an Applet
  9. Java - Opening a url in new window from an applet
  10. Applet is not Working
  11. Display image in the applet
  12. Applet Write Files Example
  13. Play Audio in Java Applet
  14. Security Issues with the Applet
  15. Swing Applet Example in java
  16. The Sample Banner Example in Java
  17. Clock Applet in Java
  18. HTML Document Creation
  19. Tag Parameters: The Tag
  20. The APPLET Tag in Detail
  21. Java and HTML: The Basics
  22. What Exactly is HTML?
  23. Welcome to the Internet
  24. java.applet package examples
  25. java.applet package examples
  26. What is an Applet - Java Applet Tutorial
  27. Java - Read file Applet
  28. Applet versus Application
  29. Tag Parameters: The Tag
  30. Java - Opening a url in new window from an applet
  31. Java - Opening a URL from an Applet
  32. Applet Tag Parameters,Applet Tag in HTML
  33. Applets in Java
  34. What is Applet in Java?
  35. What is Applet in Java with Example?