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

Is java type safe?

499


What are streams?

627


Is it possible for yielded thread to get chance for its execution again ?

544


Is null false in java?

700


How do you do descending order in java?

516






How do you achieve polymorphism in java?

511


Is break statement can be used as labels in java?

495


How to display all the prime numbers between 1 and n (n is the number, get the input from user)

504


Explain listiterator and methods in listiterator?

540


Explain the init method?

534


What is an interoperable application in java ?

579


Is null a string or object in java?

539


Who developed java?

559


What is a null point?

550


I want to persist data of objects for later use. What is the best approach to do so?

586