Java FAQ _01 Basic Concept (011) _javaapplet what is

Source: Internet
Author: User

Click to enter _ more _java thousand ask

1. What is Javaapplet?

Applets are small applications written in the Java programming language, which can be contained in HTML (an application of the standard Universal Markup Language) page, in much the same way as the page contains images. The applet does not require the main () method, which is executed by a Java virtual machine call embedded in the Web browser.

In Java applets, you can achieve graphics, font and color control, animation and sound insertion, human-computer interaction and network communication and other functions. Applets can also use the Window Environment development tool of the Abstract window Toolbox (Toolkit, AWT). AWT uses the GUI elements of the user's computer to create a standard graphical user interface, such as Windows, buttons, scroll bars, and so on.

2. How applets work

Small applications written using applets are embedded directly into the Web page, interpreted by a Java-enabled browser, and capable of producing special effects.

In the HTML file code that contains the applet Web page, the applet (using the OBJECT tag in HTML5) is labeled. When a Java-enabled web browser encounters this tag, it downloads the appropriate applet code and executes the applet on the local computer. The information about the applet in the HTML file should contain at least the following three points: the bytecode file name (the compiled Java file, with a. class suffix)
, the address of the bytecode file, and the way the applet is displayed on the Web page.

It can greatly improve the interactivity of Web pages and the ability to execute dynamically. Pages that contain applets are called java-powered pages, which can be referred to as Java-supported web pages. Because the applet is executed on the user's computer, its execution speed is not limited by the network bandwidth, the user can better appreciate the multimedia effect produced by the applet on the webpage.

3. What are the security restrictions for applets?

Because applets are downloaded from the remote server and executed locally, security is especially important. We ensure that applets are safe for the local system by restricting the applets to run in the sandbox (the applet's running environment). When applets are running in the sandbox, note the following points:

    1. You cannot run any local executable program.
    2. The applet cannot communicate with other hosts except the server that holds the downloaded applet.
    3. Cannot read and write to the local file system.
4. What is the life cycle of the applet?
    1. Applet Initialization init ()
      This method is called when the browser loads the applet and initializes it.

    2. Start Execute Start ()
      Called after the init () method. The method is also called when the user goes from another page to the page that contains the applet.

    3. Stop Stop ()
      Called when the user leaves the page containing the applet.

    4. Destroy Destroy ()
      The method is called when the applet is no longer being used, or when the browser exits.

Learn how to write an applet look here: [How to Write applet program][2]

Java FAQ _01 Basic Concept (011) _javaapplet what is

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.