1. Fundamentals Of Java Programming Language - Click here!
2. White Spaces, Data Types, Variables and Array Of Objects - Click here!
3. Method Overriding, Constructor Overloading, Scanner class! - Click here!
4. Inheritance, Interfaces, Abstract Classes and Access Specifiers! - Click here!
5. Packages In Java! - Click here!
6. Exception Handling In Java! - Click here!
7. Multithreading In Java! - Click here!
8. Applet And Graphics Programming In Java! - Click here!
What is Applet?
An applet is a small program which can displayed on a web page. It is dynamic and Interactive.
Before we start writing an applet program, we need to import .applet and .awt package.
When we declare our applet class name we need to extend pre-defined Applet class which is defined in java.applet.package.
|Applet class hierarchy|
1. Initialization or Born state = init() method.
2. Running state = Start() method.
3. Display state = Paint() method. (Not Considered).
4. Idle state = Stop() method.
5. Destroyed or Dead state = Destroy() method.
|Applet life cycle|
Following is a sample code to run an applet :
Following example demonstrates how to create a basic Applet by extending Applet Class.You will need to embed HTML code to run this program.
We can draw different shapes using the graphics class and applet class. Shapes like oval, circle, rectangle, polygon,etc. can be drawn using method like drawOval, drawPoly, drawRect, etc.
To get the programs on graphics Click here!
Rohan Chaubey is the founder of “Be Rohanlicious” – a blog that teaches you to be smart with social media, blogging and programming.
Rohan is on a mission to help all the enthusiastic souls like you, who want to “make it to the next level” and stand out of the crowd.
His e-book “Make People Want You” is releasing soon. Allow him to inject awesomeness in your life by signing up to his list here.