how to create an applet

Answers were Sorted based on User's Feedback



how to create an applet..

Answer / akansha

Here is the java code of program :

import java.applet.*;
import java.awt.*;

public class FirstApplet extends Applet{
public void paint(Graphics g){
g.drawString("Welcome in Java Applet.",40,20);
}
}


Here is the HTML code of the program:

<HTML>
<HEAD>
</HEAD>
<BODY>
<APPLET ALIGN="CENTER" CODE="FirstApplet.class" WIDTH="800"
HEIGHT="500"></APPLET>
</BODY>
</HTML>

Is This Answer Correct ?    1 Yes 0 No

how to create an applet..

Answer / krishgopal

import java.applet.*;
import java.awt.*;

/*
<applet code="app" width=400 height=500>
</applet>
*/

public class app extends Applet {
public void paint(Graphics g)
{
g.drawString("hi java",100,200);
}
}

here we use applet pack to retrive all its mathods
to create an applet.
and awt to create window events.
all that u known.
paint() is to paint the page that means
create a page and putting everything on it.
"hi java" is a string to dispaly on sgrren and
100,200 are x &y axis' to the text where to
dispaly on screen.

applet code is must to disply an applet prgrm.
width=400 height=500 r size of dispalying screen.

we can dispaly applet prgrm in any browser
with use of HTML prgrm.
for more details just refer "complete reference" book.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is class and its types?

1 Answers  


How an object is serialized in java?

1 Answers  


What is visibility mode?

1 Answers  


Does treeset allow null in java?

1 Answers  


What are the basic concepts of OOPS in java?

1 Answers   Axtria, ITC Indian Tobacco Company,


How many times finalize method will be invoked? Who invokes finalize() method in java?

1 Answers  


What is the same as procedures?

1 Answers  


Iterator in the HashMap is fail-safe means what?

9 Answers   CTS, IBM, Subex,


What does it mean to flush a file?

1 Answers  


If two threads have same priority which thread will be executed first ?

1 Answers  


How to find the given number is a prime number or not by getting input from the user

1 Answers  


java Api provided try catch finally ,try catch(its ok) but why try finally and exception occured at try then how the flow is?

1 Answers   Naaptol,


Categories