Mniproject Report.
Mniproject Report.
MINIPROJECT
REPORT
YEAR 2022-23.
MINI PROJECT REPORT ON
Submitted by
MEMBERS
Mr. Udayraj Narale [121A9033]
Mr. Nikhil Patel [121A9036]
Miss. Aditi Patwardhan [121A9042]
Miss. Nivedha Vellaipandi [121A9038]
GUIDED BY:
Prof. JYOTI CHAVHAN.
Principal
Dr. Atul Kemkar.
SIES GRADUATE SCHOOL OF TECHNOLOGY.
ACKNOWLEDGEMENT
The satisfaction and euphoria that accompany the successful completion of any task would be, but
impossible without the mention of the people who made it possible, whose constant guidance and
encouragement crowned our efforts with success.
We thank the management, Dr. Atul Kemkar, principal of SIES GRADUATE SCHOOL OF
TECHNOLOGY for providing necessary infrastructure and creating good environment. We also
record here the constant encouragement and facilities extended to us by Head of the Department of
Artificial Intelligence & Machine Learning Dr. Varsha Patil , Class Incharge, prof. Archana
Arudhkar and prof. Jyoti chavhan , of SIES GST.
We extend our sincere gratitude to them. We express our gratitude to prof. Jyoti chavhan , our
project guide for constantly monitoring the development of the project and setting up precise
deadlines. Their valuable suggestions were the motivating factors in completing the work.
We would also like to express our gratitude to SIES GST and to all our external guides at SIES GST
for their continuous guidance and motivation.
Finally a note of thanks to the teaching and non-teaching staff of Artificial Intelligence & Machine
Learning Department for their cooperation extended to us and our friends, who helped us directly or
indirectly in the course of the project work.
CERTIFICATE
This is certify that the Mini Project entitled “Stack Based Text Editor” is bonafide work carried by
Mr. Udayraj Narale , Mr. Nikhil Patel , Miss. Aditi Patwardhan , Miss. Nivedha Vellaipandi
from Department of Artificial Intelligence & Machine Learning (S.E) have satisfactorily completed .
The Mini Project “Stack Based Text Editor” is a fulfilment of term work for the subject Mini Project
in SIES GRADUATE SCHOOL OF TECHNOLOGY , Nerul during the academic year 2022-2023.
GUIDE. H.O.D.
PROF. JYOTI CHAVHAN. VARSHA PATIL.
ABSTRACT
This application is a Stack Based Text Editor in JAVA. This text editor is developed in a JAVA platform is a
replica of the word editors we all are familiar with and which we use quite often on a daily basis. The only
difference being that, this editor has been created using JAVA for the front-end interface and it is platform
independent compile once and run everywhere with basic operations of the text editor cut ,copy ,paste ,file
,edit operations and any new features can be easily coded. After opening text editor use can enter data using
keyboard and edit existing document and open menu option to use save and save as options to save file. In
order to save file we should select directory or it will show default directory. To make editing simple, we have
provided a set of pop down menus in the interface, as well as support for shortcut keys to give commands .All
the features are developed using java swings.
DECLARATION
I hereby declare that the work entitled “Stack Based Text Editor” is record of my own work carried out by me
during academic year 2022-2023 under the supervision and guidance of prof. Jyoti Chavan , Department of
Artificial Intelligence & Machine Learning (S.E) , SIES Graduate School of Technology. The extend and
source of information are derived from the existing literature and have been indicated through the dissertation
at appropriate places . the matter embodied in this work is original and has not been submitted for the award
of any other degree and diploma , either in this or any other university.
CONTENTS
CHAPTER 1
INTRODUCTION
CHAPTER 2
EDITORS
2.1 Definition
2.2 Types of Editors
2.3 Overview of Editing Process
CHAPTER 3
REQUIREMENT ANALYSIS
CHAPTER 4
IMPLEMENTATION
CHAPTER 5
CONCLUSION AND FUTURE ENHANCEMENT
5.1 Conclusion
5.2 Future Enhancement
CHAPTER 1
INTRODUCTION
BASIC FEATURES-
File open – User can either open the files already existing n the system or open a new
blank file.
Files save - one can save the file in any desired format like-.txt, .doc, .java etc. The file is
stored in the location specified by the user.
Save As- one can save the file in any desired format like-.txt, .doc, .java etc. The file is
stored in any other location specified by the user.
Cut-Copy-Paste – This editor also lets the user cut-copy-paste the edited text.
ADDITIONAL FEATURES-
Font – This feature extends the user to change the font style of the edited text.
Replace-It replaces the specified text.
Font color- dynamic change in font color during typing as per users requirement.
Scroll pane- users are not restricted for contents.
Font size- dynamic change in font size while typing as per users requirement.
This project “Text Editor” is software which can edit plain text. It is made using Java Swings and
AWT. In this project all the frames are designed in Swing. Today most programmers use Swing.
Swing is a set of classes that provides more powerful and flexible GUI components than does the
AWT. Swing provides the look and feel of the modern Java GUI.
Swing did not exist in the early days of Java. Rather, it was a response to deficiencies present in
Java’s original GUI subsystem: the Abstract Window Toolkit. The AWT defines a basic set of
controls, windows, and dialog boxes that support a usable, but limited graphical interface.
CHAPTER 2
EDITORS
2.1 DEFINITION
An editor is general-purpose system software, which can be used to enter and/or modify text,
programs, graphics or data. An editor may be a line editor, screen editor, graphics editor or word
Processors. We will be discussing all these as we move on.
The interactive editing process is accomplished with the following tasks: The part of the target
document that needs to be manipulated is viewed. The document is first displayed in the required
format.
Using the necessary designed tools, the document is modified. The view is updated appropriately and
saved in this above process, the selection of the part of the document to be viewed and edited
involves first traveling through the document to locate the area of interest. Filtering controls the
process of what is to be viewed & manipulated. Filtering extracts the relevant subset of the target
document at the point of interest, such as the next screen of the text or the next statement.
In the actual editing phase, the target document is created or altered with a set of operations such as
insert, delete, move, copy. The editing functions are often specialized to operate on elements
meaningful to the type of editor. For example, a manuscript- oriented editor might operate on
elements such as single characters, words, lines, sentences, and paragraphs; a program-oriented
editor might operate on elements such as identifiers, keywords, and statements.
In a simple scenario, the, the user might travel to the end of the document. A screenful of text would
be filtered, this segment would be formatted, and the view would be displayed on an output device.
The user could then, for example, delete the first three words of this view.
CHAPTER 3
REQUIREMENT ANALYSIS
Ram : 1GB.
INTELLIJ IDEA-
IntelliJ IDEA is an integrated development environment (IDE) written in Java for developing computer
software written in Java, Kotlin, Groovy, and other JVM-based languages. It is developed
by JetBrains (formerly known as IntelliJ) and is available as an Apache 2 Licensed community
edition,[2] and in a proprietary commercial edition. Both can be used for commercial development.
The first version of IntelliJ IDEA was released in January 2001 and was one of the first available Java IDEs
with advanced code navigation and code refactoring capabilities integrated.
In 2009, JetBrains released the source code for IntelliJ IDEA under the open-source Apache
License 2.0. JetBrains also began distributing a limited version of IntelliJ IDEA consisting of open-source
features under the moniker Community Edition. The commercial Ultimate Edition provides additional
features and remains available for a free.
In a 2010 InfoWorld report, IntelliJ received the highest test center score out of the four top Java
programming tools: Eclipse, IntelliJ IDEA, NetBeans and JDeveloper.
In December 2014, Google announced version 1.0 of Android Studio, an open-source IDE for Android apps,
based on the open source community edition. Other development environments based on IntelliJ's
framework include AppCode, CLion, DataGrip, GoLand, PhpStorm, PyCharm, Rider, RubyMine,
WebStorm, and MPS.
Supported languages
The Community and Ultimate editions differ in their support for various programming languages as shown
in the following
CHAPTER 4
IMPLEMENTATION
Change in the state of an object is known as Event, i.e., event describes the change in the state of the source.
Events are generated as a result of user interaction with the graphical user interface components. For
example, clicking on a button, moving the mouse, entering a character through keyboard, selecting an item
from the list, and scrolling the page are the activities that causes an event to occur.
Foreground Events - These events require direct interaction of the user. They are generated as
consequences of a person interacting with the graphical components in the Graphical User Interface.
For example, clicking on a button, moving the mouse, entering a character through keyboard,
selecting an item from list, scrolling the page, etc.
Background Events – These events require the interaction of the end user. Operating system
interrupts, hardware or software failure, timer expiration, and operation completion are some
examples of background events.
Event Handling is the mechanism that controls the event and decides what should happen if an event occurs.
This mechanism has a code which is known as an event handler, that is executed when an event occurs. Java
uses the Delegation Event Model to handle the events. This model defines the standard mechanism to
generate and handle the events. The Delegation Event Model has the following key participants.
Source - The source is an object on which the event occurs. Source is responsible for providing
information of the occurred event to it's handler. Java provide us with classes for the source object.
Listener - It is also known as event handler. The listener is responsible for generating a response to
an event. From the point of view of Java implementation, the listener is also an object. The listener
waits till it receives an event. Once the event is received, the listener processes the event and then
returns. The benefit of this approach is that the user interface logic is completely separated from the
logic that generates the event. The user interface element is able to delegate the processing of an
event to a separate piece of code. In this model, the listener needs to be registered with the source
object so that the listener can receive the event notification. This is an efficient way of handling the
event because the event notifications are sent only to those listeners who want to receive them.
As we know that every top-level window has a menu bar associated with it. This menu bar consists of
various menu choices available to the end user. Further, each choice contains a list of options, which is
called drop-down menus. Menu and Menu Item controls are subclass of Menu Component class.
Phase 1: Developing the background window and menu bar: The very first step in the development of the
editor is to construct the background window. Then the background color is set For each menu options
different sub windows are created and appropriate strings of different names are added into those sub
windows. Key Binding in each sub windows Each of the options in each of the menus are bound with or
associated with keys on the keyboard which are shortcuts for the user to access these options. The other way
to access them is using the movement of the cursor to navigate through them on the screen and even by
moving left and right through menus.
Phase 2: Coding functionality options In this phase we have used several inbuilt functions in the for buffers
within the editors. The various functions connect the back and front ends of the program and make it
interactive as well as efficient. Simple logic is used to code the same, for example the removal and insertion
of nodes in the list work to cut or paste text.
Phase 3: Coding for user key functions This phase maps each of the keys used by the user to a function
within the editor. The minimum movement of the user is using arrow-keys which is the first step after
enabling the keypad. After this, since ALT is used in the terminal to access various menus, we have used
CTRL with the first letter of each option to access menu-bars within the editor.
4.4.1 Code
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.plaf.metal.OceanTheme;
JTextArea textArea;
JScrollPane ScrollPane;
JLabel FontLabel;
JSpinner fontSizeSizeSpinner;
JButton fontColorButton;
TextEditor(){
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
MetalLookAndFeel.setCurrentTheme(new OceanTheme());
setLocationRelativeTo(null);
}
catch (Exception e) {
}
textArea = new JTextArea();
JMenuBar mb = new JMenuBar();
JMenu m1 = new JMenu("File");
JMenuItem mi1 = new JMenuItem("New");
JMenuItem mi2 = new JMenuItem("Open");
JMenuItem mi3 = new JMenuItem("Save");
JMenuItem mi9 = new JMenuItem("Print");
mi1.addActionListener(this);
mi2.addActionListener(this);
mi3.addActionListener(this);
mi9.addActionListener(this);
m1.add(mi1);
m1.add(mi2);
m1.add(mi3);
m1.add(mi9);
JMenu m2 = new JMenu("Edit");
JMenuItem mi4 = new JMenuItem("cut");
JMenuItem mi5 = new JMenuItem("copy");
JMenuItem mi6 = new JMenuItem("paste");
mi4.addActionListener(this);
mi5.addActionListener(this);
mi6.addActionListener(this);
m2.add(mi4);
m2.add(mi5);
m2.add(mi6);
mc.addActionListener(this);
mb.add(m1);
mb.add(m2);
mb.add(mc);
this.setJMenuBar(mb);
this.add(textArea);
this.setSize(800, 500);
this.show();
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setTitle("! Stack Based Text Editor !");
this.setSize(800,500);
this.setLayout(new FlowLayout());
this.setLocationRelativeTo(null);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setFont(new Font("Arial",Font.PLAIN,20));
ScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
}
});
fontColorButton = new JButton("color");
fontColorButton.addActionListener(this);
this.add(FontLabel);
this.add(fontSizeSizeSpinner);
this.add(fontColorButton);
this.add(ScrollPane);
this.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == fontColorButton) {
JColorChooser colorChooser = new JColorChooser();
String s = e.getActionCommand();
if (s.equals("cut")) {
textArea.cut();
} else if (s.equals("copy")) {
textArea.copy();
} else if (s.equals("paste")) {
textArea.paste();
} else if (s.equals("Save")) {
JFileChooser j = new JFileChooser("f:");
int r = j.showSaveDialog(null);
if (r == JFileChooser.APPROVE_OPTION) {
File fi = new File(j.getSelectedFile().getAbsolutePath());
try {
FileWriter wr = new FileWriter(fi, false);
BufferedWriter w = new BufferedWriter(wr);
w.write(textArea.getText());
w.flush();
w.close();
} catch (Exception evt) {
JOptionPane.showMessageDialog(this, evt.getMessage());
}
} else
JOptionPane.showMessageDialog(this, "the user cancelled the operation");
} else if (s.equals("Print")) {
try {
textArea.print();
} catch (Exception evt) {
JOptionPane.showMessageDialog(this, evt.getMessage());
}
} else if (s.equals("Open")) {
JFileChooser j = new JFileChooser("f:");
int r = j.showOpenDialog(null);
if (r == JFileChooser.APPROVE_OPTION) {
File fi = new File(j.getSelectedFile().getAbsolutePath());
try {
String s1 = "", sl = "";
FileReader fr = new FileReader(fi);
BufferedReader br = new BufferedReader(fr);
sl = br.readLine();
while ((s1 = br.readLine()) != null) {
sl = sl + "\n" + s1;
}
textArea.setText(sl);
} catch (Exception evt) {
JOptionPane.showMessageDialog(this, evt.getMessage());
}
} else
JOptionPane.showMessageDialog(this, "the user cancelled the operation");
} else if (s.equals("New")) {
textArea.setText("");
} else if (s.equals("close")) {
this.setVisible(false);
}
}
}
public class Main {
public static void main(String[] args) {
new TextEditor();
}
}
4.5 Snapshot
4.5.3 Save
CHAPTER 5
CONCLUSION AND FUTURE ENHANCEMENT
5.1 CONCLUSION
This project that we undertook was truly a very rewarding experience for us in more than one way. It has
given a big thrust to our technical knowledge as prospective Software professional. It has also helped us
enhance our skills on the personal front. The project took equal contributions from all members. We could
able to apply academic knowledge of stack data structure and object oriented programming language i.e Java
for problem solving. By adding more GUI functions or developing a user friendly website using this logic,
prove to be more beneficial for the society. we feel extremely satisfied by the fact that we have managed to
develop the project. We think we have exploited the opportunity that came our way to the fullest extent by
increasing our technical know-how and also gaining the valuable work experience apart from studying the
other subjects in our curriculum.
Automatic dictionary.
To insert images.
To have templates.