Featured Posts
Recent Articles

Java Applet

A Java applet is an applet delivered to users in the form of Java bytecode. Java applets can run in a Web Browser using a Java Virtual Machine (JVM), or in Sun’s AppletViewer, a stand-alone tool for testing applets. Java applets were introduced in the first version of the Java language in 1995, and are written in programming languages that compile to Java bytecode, usually in Java, but also in other languages such as Jython JRuby, or Eiffel (via SmartEiffel).

Java applets run at speeds comparable to, but generally slower than, other compiled languages such as C++, but until approximately 2011 many times faster than JavaScript. In addition they can use 3D hardware acceleration that is available from Java. This makes applets well suited for non trivial, computation intensive visualizations. When browsers have gained support for native hardware accelerated graphics in the form of Canvas_element and WebGL, as well as Just in Time compiled JavaScript, the speed difference has become less noticeable.

Java applets are programs that are embedded in other applications, typically in a Web page displayed in a Web Browser.

// Hello.java
import javax.swing.JApplet;
import java.awt.Graphics;

public class Hello extends JApplet {

@Override
public void paintComponent(Graphics g) {
g.drawString(“Hello, world!”, 65, 95);
}

}

The import statements direct the Java Compiler to include the javax.swing.JApplet and java.awt.Graphics classes in the compilation. The import statement allows these classes to be referenced in the source code using the simple class name (i.e. JApplet) instead of the fully qualified class name (i.e. javax.swing.JApplet).

Share and Enjoy:

0 comments for this post

Leave a reply

We will keep You Updated...
Sign up to receive breaking news
as well as receive other site updates!
Subscribe via RSS Feed subscribe to feeds
Recent Stories
Blog Archives
Recent Comments
Tag Cloud