How to Learn Java Applet

Java applets are small applications (hence the name 'applet') developed using an object-oriented programming language called Java, developed by Sun Microsystems in 1991 to 1994. Java applications can run in any operating system environment, and can deploy in most web browsers (with small tweaks for some browsers, such as Netscape). You can use Java applets to spice up your web pages by extending functionality, user interface and appearance. You can preview and download free sample applets from developer websites and modify the existing code to suit your needs. You need to have a basic grasp of software coding and deployment, particularly in Java and Hypertext Markup Language (HTML).

Things You'll Need

  • Computer Java SE Runtime Environment (JRE) Internet Access
Show More

Instructions

  1. Learning Java Applets

    • 1

      Find the resource that provides the tutorial you can work with. You can purchase or borrow books on Java development, or you can search for tutorials on the Internet.

    • 2

      Develop your Java applets using the examples provided in the tutorials. You can use the following sample 'Hello World' applet from the Sun website:
      import javax.swing.JApplet;
      import java.awt.Graphics;

      public class HelloWorld extends JApplet {
      public void paint(Graphics g) {
      g.drawRect(0, 0,
      getSize().width - 1,
      getSize().height - 1);
      g.drawString("Hello world!", 5, 15);
      }
      }
      This sample code displays a rectangular box, which shows the message: "Hello world!" in the body of your website.

    • 3

      Save your applet with the .class file extension, for example: urname.class.

    • 4

      Test your applets for functionality in the JRE. The more complicated the features you include, the more you need to test the applet.

    • 5

      Revise the code as necessary, and then save your source files (including all images and graphics) as "All Files," "Source" or "Raw Data," depending on the operating system you are using.

    • 6

      Save the applet source files in one directory of the server where you deploy your web page.

    • 7

      Embed your applet in the <BODY> area of your HTML page by adding the following call command:
      <APPLET CODE="urname.class" WIDTH="1" HEIGHT="1">
      </APPLET>
      The first line of code calls the applet you made, and then displays it in a box defined by the width and height parameters. The second line ends the call for your applet.

    • 8

      Review the web page to determine how your applet is functioning.

    • 9

      Revise your Java applet as necessary.

Tips & Warnings

  • Download only free applets for your use, do not use or modify copyrighted materials. Experiment with different types of Java applets to enhance your website. Improve your website and develop your skills by learning how to code using JavaScript, and implementing cascading style sheets (CSS).

Related Searches:

References

Resources

Comments

You May Also Like

  • How to Learn Basic Math Using Java Applets

    Learning basic math can be fun and educational for children. As computers and the Internet become more common in our everyday life,...

  • Java Applets Tutorial

    Java applets are programs written in the Java language that run in a web browser or other applet viewer. Applets have a...

  • How to Write A Java Applet

    Because Java is platform independent, Java applets are common programs that run on web pages. With a little programming experience and practice,...

  • How to Enable Java Applets

    Java seems to run perfectly fine in a browser, and it does, but many people do not realize that the browser is...

  • Java Applets Vs. Java Applications

    Java applets and applications are similar, however distinctions do exist. Applets are generally shorter and are designed to run from Web pages....

  • How to Use Graphics in a Java Applet

    Learn to use graphics in a Java applet in a few simple steps. This article will help you learn where to find...

  • Java Applet Testing

    A Java Applet is a way to use a Java program via the Internet. You can download Applets onto your computer and...

  • How to Make a JAVA Applet

    A Java applet is a small program written in Java source code. Java is an object-oriented programming language suited to client-server architectures,...

  • How to Learn Basic JAVA

    Learning basic JAVA is the key to web programming. It is a relatively difficult program to learn but if you apply yourself...

  • Tutorial on How to Write Java Applets

    Java is a strictly object oriented programming language that is popular for web development due to its ability to create code that...

Related Ads

Featured