Adv Java Microproject
Adv Java Microproject
Micro Project
on
Moving car using applet
22.Srushti Patil
23. Kusum Solanki
24.Kuashal Arekar
25. Suamitra Sawant
2021-22
CERTIFICATE
PART –A PLAN
1 Brief Introduction 1
3 Action Plan 3
4 Resources Required 4
PART –B OUTCOMES
1 Brief Description 5
2 Aim of Micro-Project 6
PART-A PLAN
1.0 Brief Introduction
An applet is a Java program that can be embedded into a web page. It runs
inside the web browser and works at client side. An applet is embedded in an
HTML page using the APPLET or OBJECT tag and hosted on a web server.
Applets are used to make the website more dynamic and entertaining.
1
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Moving car using applet JPR 22412
SEM IV
• They are simple to make and they are supported by most web browsers.
• They are faster in nature.
• At the same time, the same Applet can work on "all" installed versions of Java.
2
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Moving car using applet JPR
22412 SEM
IV
PART-B OUTCOME
A Java applet is a Java program that is launched from HTML and run in a
web browser.It takes code from server and run in a web browser.It can
provide web applications with interactive features that cannot be provided
by HTML. Since Java's bytecode is platform-independent, Java applets can
be executed by browsers running under many platforms, including
Windows, Unix, macOS, and Linux. When a Java technology-enabled web
browser processes a page that contains an applet, the applet's code is
transferred to the client's system and executed by the browser's Java
Virtual Machine (JVM).[5] An HTML page references an applet either via
the deprecated <applet> tag or via its replacement, the <object> tag.
3
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Moving car using applet JPR 22412
SEM IV
• They are simple to make and they are supported by most web browsers.
• They are faster in nature.
• At the same time, the same Applet can work on "all" installed versions of Java.
4
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Moving car using applet JPR 22412
SEM IV
5
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Moving car using applet JPR 22412
SEM IV
6
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Moving car using applet JPR 22412
SEM IV
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class Car extends Applet implements ActionListener
{
int x, y, z;
int t1,t2;
Button b1, b2;
String msg=" ";
void slep()
{
try
{
Thread.sleep(100);
}
catch(Exception ex)
{
7
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Moving car using applet JPR 22412
SEM IV
}
}
public void init()
{
t1=0;
t2=1;
x=20;
y=60;
setLayout(new FlowLayout(FlowLayout.CENTER));
Label l=new Label("webeduclick");
b1=new Button("Forward");
add(b1);
b2=new Button("Stop");
add(b2);
b1.addActionListener(this);
b2.addActionListener(this);
}
public void start()
{
}
8
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Moving car using applet JPR 22412
SEM IV
9
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Moving car using applet JPR 22412
SEM IV
g.setColor(c1);
g.drawLine(0,y+75,z,y+75);
g.setColor(Color.red);
g.fillRoundRect(x,y+20,100,40,5,5);
g.fillArc(x+90,y+20,20,40,270,180);
g.setColor(Color.BLUE);
g.fillRoundRect(x+10,y,70,25,10,10);
g.setColor(Color.white);
g.fillRect(x+20,y+5,20,25);
g.fillRect(x+50,y+5,20,25);
g.setColor(Color.black);
g.fillRoundRect(x+55,y+10,10,20,10,10);
g.fillOval(x+10,y+50,25,25);
g.fillOval(x+60,y+50,25,25);
g.setColor(Color.white);
g.fillOval(x+15,y+55,10,10);
g.fillOval(x+65,y+55,10,10);
x=x+10;
slep();
if(msg.equals("Forward"))
10
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Moving car using applet JPR 22412
SEM IV
{
if(x+120<z)
{
x=x+1;
showStatus("Press Forward for Starting Car");
repaint();
}
}
}
}
OUTPUT:-
11
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Moving car using applet JPR 22412
SEM IV
12
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Moving car using applet JPR 22412
SEM IV
13
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.