This blog is created for giving some information about the IT(information Technology) in Nepal.
Search This Blog
Monday, April 16, 2012
Applets HTML tag and attributes:
In Order to run an applet, a HTML document has to be created. Within the HTML document , we will have to add an tag pair. Following are the attributes of Applet Html tag:
Code: name of the compiled class(applet) which we are calling
Width: the width of applet on the screen.
Height: the height of applet on the screen.
Align: Specifies the alignment of an applet according to surrounding elements
Alt: Specifies an alternate text for an applet
Archive: Specifies the location of an archive file
Codebase: Specifies a relative base URL for applets specified in the code attribute
hspace: Defines the horizontal spacing around an applet
name: Defines the name for an applet (to use in scripts)
vspace: Defines the vertical spacing around an applet
Sunday, April 15, 2012
Life Cycle of an applet...
Introduction
In this Section you will learn about the lifecycle of an applet and different methods of an applet. Applet runs in the browser and its lifecycle method are called by JVM when it is loaded and destroyed. Here are the lifecycle methods of an Applet:
init(): This method is called to initialized an applet
start(): This method is called after the initialization of the applet.
stop(): This method can be called multiple times in the life cycle of an Applet.
destroy(): This method is called only once in the life cycle of the applet when applet is destroyed.
init () method: The life cycle of an applet is begin on that time when the applet is first loaded into the browser and called the init() method. The init() method is called only one time in the life cycle on an applet. The init() method is basically called to read the PARAM tag in the html file. The init () method retrieve the passed parameter through the PARAM tag of html file using get Parameter() method All the initialization such as initialization of variables and the objects like image, sound file are loaded in the init () method .After the initialization of the init() method user can interact with the Applet and mostly applet contains the init() method.
Start () method: The start method of an applet is called after the initialization method init(). This method may be called multiples time when the Applet needs to be started or restarted. For Example if the user wants to return to the Applet, in this situation the start Method() of an Applet will be called by the web browser and the user will be back on the applet. In the start method user can interact within the applet.
Stop () method: The stop() method can be called multiple times in the life cycle of applet like the start () method. Or should be called at least one time. There is only miner difference between the start() method and stop () method. For example the stop() method is called by the web browser on that time When the user leaves one applet to go another applet and the start() method is called on that time when the user wants to go back into the first program or Applet.
destroy() method: The destroy() method is called only one time in the life cycle of Applet like init() method. This method is called only on that time when the browser needs to Shut down.
What is an Applet???
Applet is java program that can be embedded into HTML pages. 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.
Advantages of Applet:
Applets are cross platform and can run on Windows, Mac OS and Linux platform
Applets can work all the version of Java Plugin
Applets runs in a sandbox, so the user does not need to trust the code, so it can work without security approval
Applets are supported by most web browsers
Applets are cached in most web browsers, so will be quick to load when returning to a web page
User can also have full access to the machine if user allows
Disadvantages of Java Applet:
Java plug-in is required to run applet
Java applet requires JVM so first time it takes significant startup time
If applet is not already cached in the machine, it will be downloaded from internet and will take time
Its difficult to desing and build good user interface in applets compared to HTML technology
What is Java???
Java is object oriented, multithreaded platform independent programming language developed by sun micro system in 1995.Java is a general purpose software development platform that is specifically designed to be open and enable application developers to "write once, run anywhere." The Java platform is most widely used in business software, web and mobile applications.
In 1995, Sun Microsystems released the Java programming language as a component of a broader strategy known as the Java platform. The "write once, run anywhere" (WORA) motto initially promised to make Java the everywhere language, running on everything from wrist watches to cell phones and laptops to supercomputers.
Java was primarily created by three individuals; James Gosling, Mark Sheridan and Patrick Naughton. They created Java in 1991 with the intention of using it as a tool for interactive television, but this idea did not come to fruition as Java ended up being too advanced for television. The three programmers originally called the language "oak", named as such because of an oak tree just outside Gosling\'s office. It was later renamed to "Green", but eventually Java was the name that stuck, after being selected from a random list of potential names.
When Java was created, Gosling, Sheridan and Naughton had five primary goals. They were:
1) It should be simple, object oriented, and familiar.
2) It should be both robust and secure.
3) It should be "architecture neutral" and portable.
4) It should execute with high performance
5) It should be interpreted, threaded, and dynamic.
The first public implementation of Java (version 1.0) was released in 1995. It was highly touted due to its "write once, run anywhere" capabilities, the ability to run on popular platforms and its inherent and configurable security.
The initial reception to Java was, to put it mildly, mixed. Some immediately saw it as a game changer, a new language that would be eventually running on everything from cell phones to laptops to toasters. Yet many pundits suggested that Java would be nothing more than a footnote in the history of computers and programming. While critics and analysts were busy taking sides, Java continued to evolve. This evolution served to accumulate more baggage as Java struggled to maintain its initial "write once, run anywhere" intention.
Major web browsers soon incorporated the ability to run Java "applets" within a web-page, and Java quickly became popular. Java soon became Java 2, released initially as Java 1.2 in 1998, it now had multiple configurations built for a variety of platforms. In 2006, Sun Microsystems released much of Java as an open source software, and completed the process the following year, making Java\'s entire core code available under the terms of free software/open-source distribution, save for one small part of the code for which Sun Microsystems did not hold the copyright.
One of the major characteristics of Java is its portability. This means that computer programs written in the Java language must run similarly on any supported hardware/operating-system platform. End-users commonly use a Java Runtime Environment ("JRE") installed on their own machine for standalone Java applications, or in a Web browser for Java applets.
In 2009-2010, Sun Microsystems was acquired by the Oracle Corporation. The initial months after Oracle made the official announcement regarding the merger with Sun were full of insecurity and discussions within the Java developer communities about the future of Java. Oracle Corp\' has characterized itself as the "steward of Java technology with a relentless commitment to fostering a community of participation and transparency". In November of 2010, Oracle and Apple announced the OpenJDK project for Mac OS X. Apple will contribute most of the main components and technology required for Java SE 7 implementation on Mac OS X.
Subscribe to:
Posts (Atom)