Java Web applet--java Applet

Source: Internet
Author: User

Java applets are compiled java programs that can be run in a Java -enabled browser.

Use of 1.Applet

 import   Java.applet.Applet;  import   Java.awt.Graphics;  public  class  Appletdemo extends    Applet  {@Override  public  void   Paint (Graphics g) {g.drawstring ( "Hello applet!", 5, +); //  draw text  G.drawarc (80,50,40,40,20,360); //  draw a circle  }}  

2.Applet program HTML file Writing

<HTML>  <Head>  <title>Applet</title>  </Head>  <Body>  <appletsCODE= "Appletdemo.class"width= "+"Height= "+"></applets>  </Body><HTML>

3.Applet Common Methods

ImportJava.applet.Applet;ImportJava.awt.Graphics; Public classAppletdemoextendsApplet {String mystring= ""; @Override Public voidPaint (Graphics g) {g.drawstring (mystring,5, 30); }     Public voidinit () {mystring= mystring + "Initializing ...";    Repaint (); }     Public voidstart () {mystring= mystring + "Starting program started ...";    Repaint (); }     Public voidStop () {mystring= mystring + "Stopping execution program ...";    Repaint (); }     Public voiddestroy () {mystring= mystring + "Recovering resources ...";    Repaint (); }}

4. Not to be continued ...

These are just concepts related to applets, basic methods for using applets , and embedding applets in HTML code. knowledge of the basic content of the program.

Java Web applet--java Applet

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.