Patel College of Sci
Transcript of Patel College of Sci
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 1/21
Patel College Of Sci. & Tech. Indore(M.P)Patel College Of Sci. & Tech. Indore(M.P)
session 2010session 2010
Training reportTraining report
presentationpresentation
Guided by:Mr. Praveen BhanodiyaHOD (CSE)
Submitted bySumit soni
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 2/21
Introduction of organization:Introduction of organization:
I have done my industrial training from DACCIT Pvt. Ltd.Which is a well known organization in indore.
Daccit was founded in 1998, work in field of softwaredevelopment.
The Organization is associated with IBM i.e. all the training
is given in the institution of IBM.
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 3/21
Technology choose:Technology choose:
y I choose the field of java for my work.
y Features of java:
y
Secured.y Simple.
y Platform independent .
y
Portable .y Multithreaded etc.
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 4/21
Topics of java I learn in my sessionTopics of java I learn in my session
of training:of training:y Polymorphism
y Inheritance.
y Data abstraction.
y Data types
y Constructors in java.
y Method overloading, method overwriting
y Generics
y Exceptional handling
y File handling
y
Applet(AWT ,Swing ).y Collection framework.
y JDBC.
y Servlets.
y JSP.
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 5/21
APPLETSAPPLETS
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 6/21
What are applets?What are applets?
y An applet is a program written in the Java
programming language that can be included
in an HTML page, much in the same way an
image is included in a page.
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 7/21
Life cycle methods of applet:Life cycle methods of applet:
y All the method of applet reside inside
´Appletµ class which reside inside
´appletµ package.
y Basically there are four life cycle method
of applet beside of that other method are
also there in Applet class.
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 8/21
MethodsMethods
1). public void init():
y The method is use to allocate the
resources like opening a file or connecting
to database.
y The method is called only once by the
browser.
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 9/21
2). public void start():
The method is concern with the statements in whichrepetitive calculation is done.
For ex. Each time we maximize our window of applet the start() method is called by the browser.
3). public void stop():
The method called by browser in two scenario.
a) When we stop the applet.
b) When we minimize the window of applet.
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 10/21
4) public void destroy():
The method is use to release all the resources that
occupied by the applet.It is called by the applet in case of close applet ,
reload applet or restart applet.
public void paint(graphics g):It is another method written always after start()
method.
As it name suggest the method is use to paint all the
graphics in our applet.
The paint method takes as a parameter a graphics
object.
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 11/21
AWT (Abstract window toolkit):AWT (Abstract window toolkit):
y The AWT package represents the AbstractWindowing Toolkit, a library of classes that givegraphical capability to applets.
y To use awt in our program we must import apackage called ́ java.awt.*µ
y By using awt we are able only to developcomponents of applet however to perform
action we need event handlers.
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 12/21
Event Delegation Model :Event Delegation Model :
y The model is used to provide
functionality in Gui components of
applets.
y We make use of certain classes and
interfaces for provide functionality on the
components.
y The reference of component areautomatically recorded in these classes.
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 13/21
For ex.
Component name Event class name
1) Button ActionEvent
2)Choice ItemEvent
3)Check Box ItemEvent
4)Text Field TextEvent
5)Scroll Bar AdjustmentEvent
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 14/21
Listeners:Listeners:
y It provide functionality on the GUI
components.
y It is in form of XXXListener where XXX
represent event class.
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 15/21
Listener name Component
1) ActionListener Button
2)ItemListener Choice
3)ItemListener Check Box
4)TextListener Text Field
5)AdjustmentListener Scroll Bar
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 16/21
Listener interface for components:Listener interface for components:
y These are pure abstract method given by
sun Microsystems.
y To provide functionality we have to write
the required block of statements in these
interfaces.
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 17/21
Component name Undefined method or default method
name
1)Button public void actionPerformed(Action Eventae)
2)Choice public void itemState(Item event ie)
3)Check Box public void itemState(item event ie)
4)Text Fieldpublic void actionPerformed(Action eventae)
5)Scroll Bar public voidadjustmentValueChanged(AdjustmentEven
t ae)
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 18/21
Basic steps to write applet program:Basic steps to write applet program:
1)Import all the required packages in the
program.
2) Create required components. Also set
size or color as per requirement.
3)Redefine there referencing methods.
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 19/21
Execution:Execution:
There are two ways to execute a applet
program:
1)The basic way is to write an HTML code
for the program and execute directly
through the web browser.
For this we need to call the name of thatclass in the HTML code.
8/8/2019 Patel College of Sci
http://slidepdf.com/reader/full/patel-college-of-sci 20/21
2) As java is a platform independent
language therefore the developers of java
provide a feature in jdk for execution
applet.For this we need to write some statement
in the program.