Page 1 | 33 A TRAINING REPORT ON “NOTEPAD-TEXT EDITOR” SUBMITTED FOR THE PARTIAL FULFILLMENT OF THE REQUIREMENT OF THE DEGREE OF BACHLOR OF TECHNOLOGY IN COMPUTER SCIENCE AND ENGINEERING (RAJASTHAN TECHNICAL UNIVERSITY) DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Submitted To: Submitted By: Prof. RITURAJ JAIN CHHATRAPAL CHOUDHARY HOD (CSE) B.Tech. 6 th Sem. 12EVECS007 VYAS INSTITUTE OF ENGINEERING AND TECHNOLOGY NH. 65, NEAR KUDI HAUD, PALI ROAD, JODHPUR- 342001
This is training report on J2SE , here we develop notepad type text editor.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
P a g e 1 | 33
A
TRAINING REPORT
ON
“NOTEPAD-TEXT EDITOR”
SUBMITTED FOR THE PARTIAL FULFILLMENT OF THE
REQUIREMENT OF THE
DEGREE
OF
BACHLOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING
(RAJASTHAN TECHNICAL UNIVERSITY)
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Submitted To: Submitted By: Prof. RITURAJ JAIN CHHATRAPAL CHOUDHARY
HOD (CSE) B.Tech. 6th Sem.
12EVECS007
VYAS INSTITUTE OF ENGINEERING AND TECHNOLOGY
NH. 65, NEAR KUDI HAUD, PALI ROAD,
JODHPUR- 342001
P a g e 2 | 33
VYAS INSTITUTE OF ENGINEERING AND TECHNOLOGY
Department of Computer Science & Engineering
CERTIFICATE
This is to certify that this Training report “Notepad- Text Editor” is the
excellence work of “ CHHATRAPAL CHOUDHARY ” Roll No.
“12EVECS007” carried out in partial fulfillment for the award of degree
of B.TECH of RAJASTHAN TECHNICAL UNIVERSITY under my
supervision.
Signature
Prof. RITURAJ JAIN
HOD (CSE)
Vyas Institute of Engineering
and Technology
P a g e 3 | 33
ACKNOWLEDGEMENT
I sincerely express my gratitude to my guide “S. Alfozen” for his benevolent
guidance in completing the report on “NOTEPAD-TEXT EDITOR”. His kindness
and help have been the source of encouragement for me.
I am grateful to him for the guidance, inspiration and constructive suggestions
which were helpful in the preparation of this Project.
CHHATRAPAL CHOUDHARY
B.Tech. 6th Sem.
12EVECS007
P a g e 4 | 33
ABSTRACT
This report describes the implementation of “Notepad- Text Editor”. It uses the
java swings to design its user interface, java.io package for perform the input
functionality and buffer is used to store the data in memory. The system can be
used to create text and perform all the functionality like copy, cut, paste, save, etc.
We can further develop the system and make it a large functionality based text
editor. We can also add coding area for developers.
P a g e 5 | 33
COMPANY PROFILE
DMatics, the IT Learning Solutions Corporation, is known for its pioneering work
in the fields of IT education and training. Our strong research has helped us
continuously innovate in the areas of instructional design methodologies, and
curricula development that is cutting-edge and most advanced.
DMatics, the brainchild of S Alfozen, it’s CEO, pioneered and nurtured the
concept of Extreme Programming Expertise. Set up in 1999, DMatics has given
a new meaning to IT Education. Committed to providing advanced IT skills to
students and professionals, DMatics has evolved into a Training Powerhouse.
The institute provides a comprehensive education environment to individuals and
enterprises, offering training that is customized to the varied needs of audiences
with diverse backgrounds.
Over the last 16 years, DMatics has enabled young engineers to become familiar
with the key tools of emerging IT and Internet age. Our initiatives, aimed at
narrowing the digital divide, have helped young engineers gain access to advanced
programming skills and enjoy programming expertise.
We have a responsibility beyond simply providing education. Research, neutrality,
developing tomorrow’s leaders, cultivating a breadth of learning… all these
endeavors and more are important components, when our philosophy and vision is
‘EXPERTISE’.
From a technical perspective DMatics has done outstanding work. We are quite
happy with the way our trainings look and operate. Most impressive has been
DMatics’s ability to make its training programs fully compliant with the
demanding standards of the industry.
Research and Development is central to DMatics’ IT learning philosophy. It is a
core strength that helps us identify the emerging market needs, leads us to create
new learning methodologies and techniques, helps us refine our curriculum,
making it cutting edge, and enables us to improve our education delivery. Our
pioneering efforts in the understanding of human cognition have added to the
learning effectiveness of our offerings.
P a g e 6 | 33
INDEX
S No. Title Page
1 INTRODUCTION 7-22
1.1 What is Java
1.1.a History of Java
1.1.b The Java “White Paper” Buzzwords
1.2 Lexical issues
1.3 Standard Organization of Java SDK
1.4 Constructors
1.5 Inheritance
1.6 Packages
1.7 Interfaces
1.8 Exception Handling
1.9 String Class
1.10 Multithreading
1.11 Applets
1.12 Event Handling
1.13 AWT
1.14 Swings
2. PROJECT OVERVIEW 23.
3. FUNCTIONAL DESCRIPTION 24
4. OPERATIONAL SUPPORT 25
5. DESIGNING PROCESS 26-30
6. FEASIBLITY ANALYSIS 31
7. CONCLUSION 32
8. BIBLOGRAPHY/ REFERENCESS 33
P a g e 7 | 33
1. INTRODUCTION TO JAVA
1.1 WHAT IS JAVA
Java was conceived by James gosling, Patrick Naughton, Chris Warth,
Ed Frank, and Mike Sheridan at Sun Microsystems, Inc. In 1991. It took 18
months to develop the first working version. This language was initially called the
“OAK”, but was renamed “JAVA” in 1995. Because of the similarities between
Java and C++, it is tempting to think of Java as simply the “Internet version of
C++”.
Dig 1 . Java Process
JVM:
JAVA
Application
(Console based) Applet (Window based)
P a g e 8 | 33
Bytecode is a highly optimized set of instruction designed to be executed by the
Java run time System, which is called the “Java Virtual Machine (JVM)”. It is
an interpreter for bytecode.
JDK:
JDK stands for Java Development kit. It provides the Environment to run Java
programs. There are three JDK editions:
Java Standard Edition (J2SE)
J2SE can be used to develop client-side standalone applications
or applets.
Java Enterprise Edition (J2EE)
J2EE can be used to develop server-side applications such as
Java servlets and Java Server Pages.
Java Micro Edition (J2ME)
J2ME can be used to develop applications for mobile devices
such as cell phones.
1.1.1 History:
Since 1995, Java has changed our world . . . and our expectations. Today, with technology such a part of our daily lives, we take it for granted that we can be connected and access applications and content anywhere, anytime. Because of Java, we expect digital devices to be smarter, more functional, and way more entertaining.
In the early 90s, extending the power of network computing to the activities of everyday life was a radical vision. In 1991, a small group of Sun engineers called the "Green Team" believed that the next wave in computing was the union of digital consumer devices and computers. Led by James Gosling, the team worked around the clock and created the programming language that would revolutionize our world – Java.
P a g e 9 | 33
The Green Team demonstrated their new language with an interactive, handheld home-entertainment controller that was originally targeted at the digital cable television industry. Unfortunately, the concept was much too advanced for the them at the time. But it was just right for the Internet, which was just starting to take off. In 1995, the team announced that the Netscape Navigator Internet browser would incorporate Java technology.
Today, Java not only permeates the Internet, but also is the invisible force behind many of the applications and devices that power our day-to-day lives. From mobile phones to handheld devices, games and navigation systems to e-business solutions, Java is everywhere!
1.1.2 The Java “White Paper” Buzzwords
The authors of Java have written an influential white paper that explains their
design, goals and accomplishments. The white paper is organized along the
following Buzzwords:
Simple Portable Object Oriented
Interpreted Distributed High
Performance
Robust Multi-Threaded Secure
Dynamic Architecture Neutral
1. Simple
The syntax of Java is a cleaned-up version of the syntax for C++. There is
no need for header files, pointer, structures, unions, operator overloading, virtual
base classes, and so on. The another aspect of being simple is being small. One of
the goals of Java is to enable the construction of software that can run stand alone
in small machines.
2. Portable
In Java, there are no implementation-dependent aspects of the
specification. The libraries that are part of the system define portable interfaces.
For e.g. there is an abstract window class and implementation of it for Unix,
Windows, Macintosh.
P a g e 10 | 33
3. Object-Oriented
Object Oriented design is a technique for programming that focuses
primarily on the data (Objects) and on the interfaces to that object.
4. Interpreted
The Java interpreter can execute Java Bytecodes directly on any machine
to which the interpreted has been ported.
5. Distributed
Java has an extensive library of routines for coping with TCP/IP protocols
like HTTP and FTP. Java applications can open and access objects across the Net
via URLs with the same ease as when accessing a local file system.
6. High Performance
While the performance of interpreted bytecodes is usually more than
adequate, there are situations where higher performance is required. The
bytecodes can be translated on the fly (at run time) into machine code for the
particular CPU the application is running on.
7. Robust
Java is intended for writing programs that must be reliable in a variety of
ways. Java puts a lot of emphasis on early checking for possible problems, later
dynamic (run-time) checking, and eliminating situations that are error-prone.…
The single biggest difference between Java and C/C++ is that Java has a pointer
model that eliminates the possibility of overwriting memory and corrupting data.
8. Multi-Threaded
P a g e 11 | 33
The benefits of multithreading are better interactive responsiveness and real-time
behavior. If you have ever tried to do multithreading in another language, you will
be pleasantly surprised at how easy it is in Java. Threads in Java also can take
advantage of multiprocessor systems if the base operating system does so. On the
downside, thread implementations on the major platforms differ widely, and Java
makes no effort to be platform independent in this regard
9. Secure
Java is intended to be used in networked/distributed environments. Toward
that end, a lot of emphasis has been placed on security. Java enables the
construction of virus-free, tamper-free systems.
10. Dynamic
In a number of ways, Java is a more dynamic language than C or C++. It
was designed to adapt to an evolving environment. Libraries can freely add new
methods and instance variables without any effect on their clients. In Java, finding
out run time type information is straightforward.
1) Static binding in Java occurs during Compile time while Dynamic
binding occurs during Runtime. 2) private, final and static methods and variables
uses static binding and bonded by compiler while virtual methods are bonded
during runtime based upon runtime object.
11. Architecture Neutral
The compiler generates an architecture-neutral object file format—the
compiled code is executable on many processors, given the presence of the Java
runtime system.
To enable a Java application to execute anywhere on the network, the
compiler generates an architecture-neutral object file format--the compiled code is
executable on many processors, given the presence of the Java runtime system.
P a g e 12 | 33
1.2 Lexical Issues
1. white spaces
Space bar, new-line, tab.
2. identifier
Variables name, methods name, and class name are called identifiers.
3. literals
15, 18.1, ‘X’, “Hello World”.
4. comments
1. Line Comment using //
2. Block Comment using /* */
3. Documentation Comment /** */
5. separators
() {} [] , . ;
6. keywords
There are 49 keywords in java. These keywords cannot be used as
identifiers.
1.3 Standard Organization of Java SDK
\jdk
Docs Contains Library Documentation in HTML format
Bin Contains Application Development Tools
Demo Contains Demonstration Programs
Lib Contains Library Files
Src Contains Library Source
P a g e 13 | 33
1.4 Constructor
In class-based object-oriented programming, a constructor (abbreviation:
ctor) in a class is a special type of subroutine called to create an object. It
prepares the new object for use, often accepting arguments that the
constructor uses to set required member variables.
It is the same name as that of a class.
It looks like a method but it is not exactly a method.
There is no return type.
Constructor should be public type.
It is called implicitly or automatically at the time of class
instantiation.
It is a first block that is called by a java.
Types of constructor:
1. Default Constructor
2. Argumented Constructor
3. Copy Constructor
1.5 Inheritance
A class that is derived from another class is called subclass and inherits all fields
and methods of its superclass. In Java, only single inheritance is allowed and thus,
every class can have at most one direct superclass. A class can be derived from
another class that is derived from another class and so on.
Types of Inheritance in JAVA:
1. Single Inheritance:
P a g e 14 | 33
Single inheritance is damn easy to understand. When a class extends
another one class only then we call it a single inheritance. The below flow
diagram shows that class B extends only one class which is A. Here A is a
parent class of B and B would be a child class of A.
2. Multilevel Inheritance:
Multilevel inheritance refers to a mechanism in OO technology where one
can inherit from a derived class, thereby making this derived class the base
class for the new class. As you can see in below flow diagram C is
subclass or child class of B and B is a child class of A. For more details
and example refer
3. Hierarchical Inheritance:
In such kind of inheritance one class is inherited by many sub classes. In
below example class B, C and D inherits the same class A. A is parent
class (or base class) of B, C & D.
In Java Parent Class are known as Super class and child class is known as Sub
class.
1.6 Packages
It is a folder which contains subfolders and .class files or, in another words
Package is a collection of .class files and sub packages.
A package is a grouping of related types providing access protection and
name space management. Note that types refer to classes, interfaces,
enumerations, and annotation types. Enumerations and annotation types
are special kinds of classes and interfaces, respectively, so types are often
referred to in this lesson simply as classes and interfaces
To import a package in another class, the syntax is:
Import package-name.classname
P a g e 15 | 33
1.7 Interface
It is an abstract class. we declare the methods in an abstract class and the
definition of all methods declare in an Interface must be defined in its child class.
Java does not support multiple inheritance using extends keyword but it is
possible with the help of interface. Here we use the implements keyword. an
interface is a reference type, similar to a class, that can contain only constants,
method signatures, and nested types. There are no method bodies. Interfaces
cannot be instantiated—they can only be implemented by classes or extended by
other interfaces.
1.8 Exception handling
Run time errors are called Exception Handling. Exceptions are generating when
an abnormal condition are existing and execution of the program stop. Even
programmer doesn’t know which type of error can be generated to handle these
type of errors we use Exception handling.
An exception is a representation of an error condition or a situation
that is not the expected result of a method.
Exceptions are built into the Java language and are available to all
program code.
Exceptions isolate the code that deals with the error condition from
regular program logic.
Types of Exception Handling
Checked (Reported Exception)
o Checked exceptions include errors such as “array index out of
bounds”, “file not found” and “number format conversion”.
Unchecked (Un Reported Exception)
P a g e 16 | 33
o Unchecked exceptions include errors such as “null pointer”, “class
not found”, “Interrupted Exception”.
To handle exception:
o To handle the exception, you write a “try-catch” block. To pass the
exception “up the chain”, you declare a throws clause in your method or
class declaration.
o If the method contains code that may cause a checked exception, you
MUST handle the exception OR pass the exception to the parent class
(remember, every class has Object as the ultimate)
7
Example
try {
… normal program code
}
catch(Exception e) {
… exception handling code
}
1.9 String Class
Java Implements string through a class called ‘String’. The ‘String’ class is
defined in the package ‘java.lang’, which is automatically imported in all java
programs The ‘String’ class is declared as final hence it cannot be sub-classed.
The 'String’ object represents a fixed length immutable character.
There are many function which are used in string class methods:
int length()
character charAt()
Boolean equalsIgnoreCase(str)
P a g e 17 | 33
Boolean endsWith(str)
Boolean startsWith(str)
int indexOf(char)
int lastIndexOf(char)
string concat(string)
String replace()
String trim()
String toLowerCase()
String toUpperCase()
Function which are used in string buffer class:
int length()
int capacity()
char charAt(int where)
string insert()
string reverse()
string delete()
string substring()
1.10 Multithreading
The benefits of multithreading are better interactive responsiveness and
real-time behavior. If you have ever tried to do multithreading in another
language, you will be pleasantly surprised at how easy it is in Java. Threads in
Java also can take advantage of multiprocessor systems if the base operating
system does so. On the downside, thread implementations on the major platforms
differ widely, and Java makes no effort to be platform independent in this regard.
it is smallest part of a program.
P a g e 18 | 33
C.P.U execute one thread at a time if we divide our program in
multiple threads that program is called Multithreaded program.
There are two process to create a thread
By Thread class
By Runnable class
Methods use for a single thread are:
Thread currentThread()
String getName()
int getPriority()
void setName(String)
void setPriority(int)
void sleep (long ms)
Methods use for a multithreading threads are:
void run()
void start()
1.11 Applets
A Java applet is a small application which is written in Java and delivered
to users in the form of bytecode. The user launches the Java applet from a web
page, and the applet is then executed within a Java Virtual Machine (JVM) in
a process separate from the web browser itself.
The Applets are used to provide interactive features to web applications that
cannot be provided by HTML alone. They can capture mouse input and also
have controls like buttons or check boxes. In response to user actions, an
applet can change the provided graphic content. This makes applets well-
suited for demonstration, visualization, and teaching. There are online applet
collections for studying various subjects, from physics to heart physiology.
An applet can also be a text area only; providing, for instance, a cross-
platform command-line interface to some remote system. If needed, an applet
P a g e 19 | 33
can leave the dedicated area and run as a separate window. However, applets
have very little control over web page content outside the applet's dedicated
area, so they are less useful for improving the site appearance in general
(while applets like news tickers or WYSIWYG editors are also known).
Applets can also play media in formats that are not natively supported by the
browser.
1.12 Event Handling
• Every time a user types a character or pushes a mouse button, an event
occurs.
• Any object can be notified of an event by registering as an event listener
on the appropriate event source.
• Multiple listeners can register to be notified of events of a particular type
from a particular source.
Event handling process is describe below ( using diagram) : -
Dig. 2 Event Handling in AWT
P a g e 20 | 33
Types of Event Listeners
ActionListener
Window Listener
MouseListener, etc.
Implement event handler
Implement a listener interface or extend a class that implements a listener
interface.
Register an instance of the event handler class as a listener upon one or
more components. Implement the methods in the listener interface to
handle the event
1.13 AWT
The classes and interfaces of the Abstract Windowing Toolkit (AWT) are used to
develop stand-alone applications and to implement the GUI controls used by
applets. These classes support all aspects of GUI development, including event
handling. The Component and Container classes are two of the most important
classes in the java.awt package. The Component class provides a common
superclass for all classes that implement GUI controls. The Container class is a
subclass of the component class and can contain other AWT components. The
Window class is a subclass of the Container class that provides a common set
of methods for implementing windows. The Window class has two subclasses,
Frame and Dialog, that are used to create Window objects. The Frame class
is used to create a main application window, and the Dialog class is used to
implement dialog boxes.
AWT classes:
P a g e 21 | 33
BorderLayout
Button
CheckBox
Frame etc.
AWT support the following types of control:
Labels
Push buttons
Checkbox
Lists
Scroll bar
1.14 Swing
Java Swing is a part of Java Foundation Classes (JFC) that is used to create
window-based applications. It is built on the top of AWT (Abstract Windowing
Toolkit) API and entirely written in java.
Unlike AWT, Java Swing provides platform-independent and lightweight
components.
• Swing provides many standard GUI components such as buttons, lists,
menus, and text areas, which you combine to create your program's GUI.
• Swing provides containers such as windows and tool bars.