Explain the applet in java, JAVA Programming

Assignment Help:

Explain The Applet in java?

The reason people are excited about Java as more than just another OOP language is because it allows them to write interactive applets on the web. Hello World isn't an extremely interactive program, other than let's look at a webbed version.
import java.applet.Applet;
import java.awt.Graphics;

public class HelloWorldApplet extends Applet {

public void paint(Graphics g) {
g.drawString("Hello world!", 50, 25);
}
}
The applet version of HelloWorld is a little more complicated than the HelloWorld application, and it will take a little more effort to run it as well.
First kind in the source code and save it into file known as HelloWorldApplet.java. Compile this file in the usual way. If all is well a file known as HelloWorldApplet.class will be formed. Now you required to create an HTML file that will involved your applet. The following easy HTML file will do.
< html>
< head>
< title> hello world
< /head>

< body>
This is the applet:< P>
< applet code="HelloWorldApplet" width="150" height="50">
< /applet>
< /body>
< /html>

Save this file as HelloWorldApplet.html in the similar directory as the HelloWorldApplet.class file. While you've done that, load the HTML file into a Java enabled browser. You should see something like below, by of course the exact details depend on that browser you use.

If the applet compiled without error and produced a HelloWorldApplet.class file, and yet you don't see the string "Hello World" in your browser chances are that the .class file is in the wrong place. Make sure HelloWorldApplet.class is in the similar directory as HelloWorld.html. Also make sure in which your browsers supports Java or that the Java plugin has been installed. Not all browsers support Java out of the box.

Several browsers have less than perfect support for Java so if you have trouble along with an applet, the first thing to try is loading it within Sun's Applet Viewer instead. If the Applet Viewer has a problem, then chances are pretty good the problem is with the applet and not with the browser.


Related Discussions:- Explain the applet in java

What is alternate text, What is Alternate Text ? The APPLET element ca...

What is Alternate Text ? The APPLET element can have an ALT attribute. An ALT attribute is used through a browser which understands the APPLET tag but for some purpose cannot

I need the app to be developed for android, I have a very simple app that I...

I have a very simple app that I have developed and is in the AppStore. I need the app to be developed for Android as it is presently in Objective C only. All plist html/ lists s

java garbage collector? , Each time an object is operated in Java, it goes...

Each time an object is operated in Java, it goes into the area of memory named as heap. The Java heap is named the garbage collectable heap. The garbage collection may not be force

What happens to static fields of class during serialization, What happens t...

What happens to the static fields of a class during serialization? There are three exceptions in which serialization does not necessarily read and write to the stream. These

Page replacement algorithms code in nachos, what is the code for page repla...

what is the code for page replacement algorithms in nachos os

What do you understand by the term constructor in java, Question: (a) ...

Question: (a) What are the main differences between an object and a class? Illustrate with appropriate examples. (b) Differentiate between a global variable and a local va

Development of an android app urgent, Development of an Android app urgent ...

Development of an Android app urgent Project Description: I am searching for some good android developer who has depth in knowledge of making an app. I am focusing on a certa

Describe the edit phase- java program development, Describe the Edit phase-...

Describe the Edit phase- Java Program Development Phase comprises editing a file. This is done with an editor program. Programmer types a java program using editor such as no

Prepare android antivirus with locate device capability, Prepare Android An...

Prepare Android Antivirus with locate device capability Project Description: We need a developer that can develop an Android Antivirus similar to lookout Developer need to prov

Describe logical operators in java, Describe Logical Operators in Java ? ...

Describe Logical Operators in Java ? The relational operators you've learned so far ( , >=, !=, ==) are enough while you only required to check one condition. Therefore what if

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd