how to create an applet

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

When the constructor of a class is invoked?

583


What is primitive data type in java?

537


Name component subclasses that support painting in java programming?

628


What is a nested list?

511


What is byte data type?

546






What is the use of put method?

514


Can we have any code between try and finally blocks?

556


What is default size of arraylist in java?

553


What happens to the Exception object after handling an exception?

1806


What do you understand by a Static Variable?

624


State some advantages of java?

708


What is bitwise complement?

498


What are streams in java 8?

546


Can a class be final?

494


What is initial size of arraylist in java?

534