Applets:
In the very early days of the Java language - all the way back in 1995 - the most exciting thing was that Java could be used to add animation, processing and interactivity to web pages. Until then, most web pages had been more or less static, with just the possibility of a bit of form-filling as the most dynamic activity on offer.
Very early demonstrations at conferences and across the web involved many animations of steaming coffee cups as well as more ambitious graphical displays. This was all achieved by means of applets, which are Java programs that are downloaded as bytecode along with a web page and run by the browser when the web page is viewed. Since those early days, things have moved on - there are other ways of making web pages more interactive (such as the JavaScript language); processing for web-based applications can be done more efficiently in many cases (using servlets and Java Server Pages); there are also strong competitors for graphics and animation (such as animated GIF files or various proprietary graphics and animation products).
The designers of Java also deliberately restricted what applets are normally allowed to do - for example, they usually cannot access files on the client computer where they are executed. This is because you generally should not trust programs that you download from the web, perhaps unknowingly, by simply clicking on a web link.
Nevertheless, applets can be very useful and their security features can be an advantage in some cases. In this section, we will explain when to use applets and how to write them.
How an applet works
In many ways, a Java applet is similar to a Java application. In both cases, you write Java source code, compile it to bytecode and store it in a file with a name ending in .class. The difference comes in how this bytecode file is then invoked and executed. An application is typically installed directly on a particular computer and run there although, as we shall see later, it may be invoked from a remote computer. When an application is run, the bytecode is interpreted and executed by the Java Virtual Machine (JVM) on the computer where the application resides.
By contrast, the bytecode for an applet is normally run when an associated web page is loaded into a browser. If the web page is loaded from a web server on a remote computer, then any applet bytecode linked to that web page is also downloaded and run.
The applet bytecode is actually interpreted and executed by a suitable web browser - a so-called Java-enabled browser. The sequence of events in the process of downloading and executing an applet is illustrated in Figure.
Figure: Sequence of events showing how applets work
As the name 'applet' suggests, an applet is typically a small piece of code, but it need not be, as long as users are prepared to wait for a larger applet to download along with its associated web page. In most cases, users will not want to wait, so limiting applets to manageable size is a good aim.
Applets can also be viewed using a standard application called the appletviewer - this comes as part of the JDK, the freely available Java Development Kit. This is often useful for testing during development of an applet.
Java Assignment Help - Java Homework Help
Struggling with java programming language? Are you not finding solution for your Applets homework and assignments? Live Applets experts are working for students by solving their doubts & questions during their course studies and training program. We at Expertsmind.com offer Applets homework help, java assignment help and Applets projects help anytime from anywhere for 24x7 hours. Computer science programming assignments help making life easy for students.
Why Expertsmind for assignment help
- Higher degree holder and experienced experts network
- Punctuality and responsibility of work
- Quality solution with 100% plagiarism free answers
- Time on Delivery
- Privacy of information and details
- Excellence in solving java programming language queries in excels and word format.
- Best tutoring assistance 24x7 hours