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

What is parse method?

543


What Is Composition?

583


How many threads can I run java?

540


Can It is possible to synchronize the constructor of a Java Class?

594


What is a condition in programming?

558






Can we change the value of static variable?

501


Can we make main() thread as daemon?

578


What is difference between an object and a class?

615


What is meant by class loader? How many types are there?

676


What is the difference between the paint() and repaint() methods?

589


What is boolean example?

527


Can we create a constructor in abstract class?

575


What are the different ways of implementing thread? Which one is more advantageous?

538


What was java originally called?

512


What does null mean in java?

631