What Is HTML Markup Language?

What Is HTML In General?

What is HTMLSo what is HTML? let me tell you this, HTML(HyperTextMarkupLanguage) is a markup language that has been the standard of creating web pages and applications worldwide. With Cascading Style Sheets (CSS) and Javascript that would perfectly fit right in to create the most stunning website. Basically, the answer to “What is HTML” is that HTML = a markup language that makes website creation possible. Continue reading What Is HTML Markup Language?

Java Applet

Applet is a Java program that runs on the browser. An applet that runs on the browser can be a fully functional java program because it has the entire Java API at its disposal. So if you can make a movingBall program on standalon Java, you can also makes it work on the web browser.

Here are the differences beetween a normal standalon Java and Java Applet that runs on the web, take a look :

  • Applets are designed to be embedded within an HTML page.
  • A main() methods is not invoked and used in applet, applet does not uses or define main() method.
  • An applet is a Java Class that extends the java.applet.Applet class.
  • A JVM is required to use applet. The JVM can be a plug-in from the web browser or a separate runtime environment. 
  • It needs a plugin to work.

The advantages of java applet is a following :

  • Secured.
  • It works on side of the client so it will take less response time. 
  • It runs on the web browser, it also means that it is multi platform as long as the web browser is supported by multiple platform like Linux, Windows, Mac etc…

Just like standalone java, java applet also has a lifecycle. Which less or more like this :

  1. Applet is initiliazed ( init() = Used to initialize the applet, only invoked once)
  2. Applet is started (start() = Used to start the applet after the applet is initialized)
  3. Applet is painted
  4. Applet is stopped (stop() = Used to stop the applet, only invoked once the applet is stopped or the browser is closed)
  5. Applet is destroyed (destroy() = Used to destroy the applet, only invoked once)

There are 2 ways to start applet :

  • By html file.
  • By appletViewer tool (for testing purpose).

And finally here is the example :

//First.java
import java.applet.Applet;
import java.awt.Graphics;
public class Example extends Applet{
public void paint(Graphics g) {
g.drawString(“HELLO”, 100, 100);
}
}

Now we use it in the applet, in the html that is runned on the browser :

<html>
<body>
<applet code = “Example.class” width = “200” height = “200”>
</applet>
</body>
</html>

Conclusions

  • Applet is a Java program that runs on the browser. An applet that runs on the browser can be a fully functional java program because it has the entire Java API at its disposal.
  • Applet can be multiplatform.
  • Used html to be runned on the browsers.
  • Runs on the browser by plugins.