Practical No. 28

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Practical No.

28
Program Code:
import java.applet.*;

import java.awt.*;

public class Hello extends Applet {

public void paint(Graphics g) {

g.drawString("java",10,100);

}}

/*<applet code = "Hello.class"width=500 height=500></applet>*/

Exercise:
Q1) Develop a basic applet program to display “Welcome to the World of Applet”.

Q2) Develop a program to implement all methods of applet.


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

/*

<applet code = "Applet1.class" width = 400 height = 200>

</applet>

*/

public class Applet1 extends Applet {

public void init() {

System.out.println("Initializing an applet");

public void start(){

System.out.println("Starting an applet");

public void stop(){

System.out.println("Stopping an applet");

public void destroy() {

System.out.println("Destroying an applet");

public void paint(Graphics g){

g.drawString("Welcome",50,30);

Q3) Develop a program using control loops in applets.


import java.applet.*;

import java.awt.*;

public class AppletBal extends Applet {


String str1;

public void init() {

str1 = getParameter("Bal");

public void paint(Graphics g) {

int bal = Integer.parseInt(str1);

if (bal < 500)

g.drawString("Low Balance",50,30);

else

g.drawString("Succffcient Balance", 50,30);

}}

/*

<applet code = "AppletBal.class" width = 500 height = 500>

<param name = "Bal" value = "600">

</applet>

*/

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy