Java Applications Examples: The Applet

javaAn applet is simply a Java application that runs on the web. The applet has some difference with the applications, because they have no main, classes are called as the file that contains the class that extends Applet package java.applet.
Even for JApplet applet version of swing there, which is used to add Swing components instead of AWT components.
An applet needs a html file that calls for it, for example, bothFirstApplet.java we want to execute the applet, the compile and the compiler generatesFirstApplet.class us, we need to run a html file that contains within it the TAGS:

<applet code=”PrimoApplet.class”> </ applet>

Suppose that this file is called test.html at this point we have two ways to run the applet, the first being debugged program is using the JDK appletviewer, and write in this case from the DOS prompt:

appletviewer test.html

the second is using a web browser such as Explorer or Netscape test.html drawing file.
As you can see, it always launches the HTML file, and not as it was for the applications. Class file is the html file that invokes the application. Java.
For more details on html pages I suggest you consult the website HTML.IT the sections on the topic, we will thin the pages that will only serve to load our applet, for example, the appletFirstApplet.class before, the file test.html will be something like:

<html>
<head>
<title>FirstApplet Applet </ title>
</ Head>
<body>

The following is

appletFirstApplet.class

<applet code=”PrimoApplet.class” width=100 height=100> Your browser is old, change it </ APPLET>
</ Body>
</ Html>

We have seen how to send running the applet, now creiamolo. First we must create a class calledFirstApplet extending the java.applet.Applet class, and we must define some methods that the system (appletviewer or browser) will invoke automatically. One such method called paint (Graphics O), and Graphics is an object that represents the screen of the applet, we redefine to make out on screen what we prefer.
We will use the DrawString method of the Graphics class to print a string on screen.

Java and mobile applications

Java is used to build solid and stable applications for mobile devices (android, ios and bb10), further info on freappwebsite and AppzMob.