Professional Documents
Culture Documents
Project Report on
Mrs.S.B.Chavan
1
CERTIFICATE
This is to certify that the project entitled " Develop a Rainbow and
House using java aaplet “has been carried out been
1. Punde Siddhi(43)
2. Sahu Sarala(46)
3. Shingote Ankit(52)
4. Shirsath Nikita(53)
5. Shripat Komal(54)
Index
2
Sr.No Topic Name Page No
1 Introduction 5
2 Aim of the project 5
3 Course outcomes 5
4 Actual procedure followed 6
5 Source code 8
6 Output of the code 11
7 Action plan 12
8 Skill development/learning of this 13
microproject
9 Conclusion 13
10 Reference 13
Acknowledgement
3
We take this opportunity to thank our guide Mrs.S.B.Chavan for placing this
idea in our mind and giving marvelous suggestions from the platform of this
project. We are pleased to take Opportunity to construct a project " Develop a
Rainbow and House using java aaplet” . The project title would not have
been completed without the valuable Guidance and encouragement of my
family and friends.
4
Develop a Rainbow and House using java aaplet
Introduction:
In this project we are going to design Rainbow and House using Java
Applet. In this, we import firstly Applet and Awt packages to run applet
program. In our project, the user defined class is extended from Applet class to
inherite all methods of Applet class. We have used Graphics class object in
paint() method as an argument to call drawLine() methods. We have used try
and catch block to handle the exception. In this we also uses the concept of
thread. To execute the thread, we have used Runnable Interface. To run applet
program we have to make html program using applet tag. To execute applet
program we will use Applet viewer tool as " Appletviewer program_name.
java".
5
In this project ,we design Rainbow and House using java Applet
and Graphics Programming. we include Exception handling and
Multithreading,Inheritance functions. The console based applications are not
user friendly to handle for the end user by cause lack of Graphics.
In this project, Firstly we import 2 types packages. java.applet,it contain
classes for creating Applet and java.awt for the paint() method and it contains
Graphics class object.
Then we create a class Rainbow which is extend from Applet class.We started
class name with public keyword because we use all the method of Applet class.
Then we declare slep() method. In sleep() method we write try and catch block.
In try block wecall the tread class sleep() metho. It causes currently thread stop
excuting for 1000 milisec(1sec).
Then we declare Applet class init() method. This method used to initialize the
Applet. Then in we declare Graphics class paint() method the actual code is
present in this method. We create g object of Graphics class to call the Graphics
class methods.
By using g object we call the drawArc() method to draw a Arc for Rainbow. For
Rainbow we RGB colour value. For rainbow 7 colures we use for loop. In for
loop we call sleep() method for delay 1sec.
The for loop is end, complete Rainbow is display. For display a house we use
different Graphics class methods like drawRect() method for draw a rectangle.
drawPolygon() method for draw a polygon. We use drawPolygon() method for
draw a triangle.
We use setcolor() method to set the color of House and Rainbow. We call the
this .ethod using object g.We use Font class fr display a message.
To excute this Applet code we have used Applet tag in the command section in
our project. This command section is read by the Appletviewer tool not by the
compiler
To compile the program. :- javac rainbow.java
Resources Required :
6
Sr. No. Resources Specification Quantity
Used
2 Operating Windows 10 1
System
3 Software JDK 1
1.8.0,Notepad,
Command Prompt,
5.Program code:
7
import java.applet.*;
import java.awt.*
int x,y,z;
x=0;y=50;z=100;
8
for(int i=0;i<7;i++)
{
Color c1=new Color(z,x,y);
x=(x+50)%255;
y=(y+70)%255;
z=(z+100)%255;
g.setColor(c1);
g.fillArc(50+(i*20),20+(i*20),600-(i*40),600-(i*40),0,180);
sleep();
}
Font home=new Font ("Century Gothic",Font.BOLD,28);
g.setFont(home);
g.drawString("H O U S E",20,80);
int a[]={150,300,225};
int b[]={150,150,25};
int c[]={ 225,300,550,475};
int d[]={ 25,150,150,25};
g.setColor(Color.red);
g.fillRect(150,150,150,200);
g.setColor(Color.green);
g.fillRect(190,220,70,130);
g.setColor(Color.red);
g.fillPolygon(a,b,3);
g.setColor(Color.yellow);
g.fillOval(200,75,50,50);
9
Font dell=new Font("Century Gothic",Font.BOLD,20);
g.setFont(dell);
g.setColor(Color.red);
g.drawString("DELL",204,100);
g.setColor(Color.red);
g.fillRect(300,150,250,200);
g.setColor(Color.black);
g.fillRect(390,210,80,80);
g.drawLine(150,150,300,150);
g.drawLine(300,150,300,350);
g.drawLine(150,150,150,350);
g.setColor(Color.black);
int e[]={ 190,240,240,190};
int f[]={ 220,240,330,350};
g.fillPolygon(e,f,4);
g.setColor(Color.blue);
g.drawLine(430,210,430,290);
g.setColor(Color.yellow);
g.fillPolygon(c,d,4);
10
6.Output of the Code:
7. Action plan
9. Conclusion :
This project is useful to display the design of Rainbow and House. In
this, we have used try, catch block to handle exception, so the program will
execute successfully. We have used thread concept by increasing rainbow
design of home.
10. References :
https://www.javapoint.com/
https://www.wikipedia. org
https://youtube. com
12
13
14