Java Applets And Its Uses
What is an applet in java, and what are its uses?
An applet is a software component that enables client-side programming and facilitates text, graphics, audio, imaging, animation and networking, besides live updating and securing two way interaction in web pages.One of the main features of java is the applet.These are usually small in size.Applets are used to embed the code in a web browser and to generate the dynamic contents and its works on the client side.Its response time is very fast.
The main features of applets are following:
- It provides a GUI
- Facilitates graphics,animation and multimedia.
- Provides a facility for frames.
- Enable event handling.
- Avoid a risk and provides a secure two-way interaction between web pages.
Applet Life cycle:
The life cycle consists of five methods: These methods are used as follows:
init() —> It is called only once when the applet is first loaded and created by the browser.
start() —> It runs whenever the applet becomes visible.
paint(Graphics g) —> Display the content on the applet.
stop() —> It is called when the becomes invisible.
destroy() —> It is called when the applet is shutdown.
Every applet program starts execution from init().Here not writing the main method.
init() ,start() ,stop() ,destroy() These four methods are available in java awt applet class and paint() method java awt component class.
What is AWT in java?
The AWT is a java framework has a set of Java classes that provide the standard user-interface elements(windows,menus,boxes,buttons,lists and so on).That is,AWT provides several facilities for drawing two-dimensional shapes,controlling color and font.The java foundation class (JFC) provides two frameworks for building graphical user interface(GUI) based applications.
1 AWT (Abstract Window Toolkit)-The class hierarchy of AWT
2 Swing
The AWT is a java framework has a set of Java classes that provide the standard user-interface elements(windows,menus,boxes,buttons,lists and so on).That is,AWT provides several facilities for drawing two-dimensional shapes,controlling color and font.The java foundation class (JFC) provides two frameworks for building graphical user interface(GUI) based applications.
1 AWT (Abstract Window Toolkit)-The class hierarchy of AWT
2 Swing
Implementation of java applets are done in two ways.
1 By using an HTML file.The main drawback of using HTML files is that the browser should have a Java plugin installed.
2 By using the appletviewer tool.
What is HTML?
Hyper Text Markup Language.Which is used to create the web pages.
Applet Hierarchy In Java
Comments
Post a Comment