Notepad Program
A Blue J (Java) Project
Siddharth Nair
XII Sienna
39
Acknowledgement
I Siddharth Nair of class XII would like to thank my teacher,
my parents and my brother who helped me created this
project and supported me through out. I would like to thank
my especially my computer teacher Megha Miss who gave us
a freedom of choice of topic. I would like to thank my brother
who has been of a great help.
Last but not the least I would like to thank Larry Page and
Sergey Brin who created Google, it was of a tremendous
help.
About Blue J and Java
Java allows one to play online games, chat with people around
the world, calculate your mortgage interest, and view images in
3D, just to name a few. It's also integral to the intranet
applications and other e-business solutions that are the
foundation of corporate computing. Java is a computer
programming language that is concurrent, class-based, objectoriented, and specifically designed to have as few
implementation dependencies as possible. It is intended to let
application developers "write once, run anywhere" (WORA),
meaning that code that runs on one platform does not need to
be recompiled to run on another. Java applications are
typically compiled to byte code (class file) that can run on
any Java virtual machine (JVM) regardless of computer
architecture. Java is, as of 2012, one of the most popular
programming languages in use, particularly for client-server
web applications, with a reported 9 million developers
BlueJ is an integrated development environment (IDE) for
the Java programming language, developed mainly for
educational purposes, but also suitable for small-scale software
development. It was developed to support the learning and
teaching of object-oriented programming, and its design differs
from other development environments as a result. The main
screen graphically shows the class structure of an application
under development (in an UML-like diagram), and objects can
be interactively created and tested. This interaction facility,
combined with a clean, simple user interface, allows easy
experimentation with objects under development. Objectoriented concepts (classes, objects, communication
through method calls) are represented visually and in its
interaction design in the interface.
Notepad
Notepad is a simple text editor for Microsoft Windows. It has
been included in all versions of Microsoft Windows since
Windows 1.0 in 1985.Notepad is a common text-only (plain
text) editor. The resulting filestypically saved with
the .txt extensionhave no format tags or styles, making the
program suitable for editing system files that are to be used in
a DOS environment and occasionally, source code for
later compilation or execution, usually through a command
prompt. Notepad supports both left-to-right and right-to-left
based languages. Unlike WordPad, Notepad
does not treat newlines in UNIX- or Mac-style text files
correctly. Notepad offers only the most basic text manipulation
functions, such as finding text. Only newer versions of Windows
include an updated version of Notepad with a search and
replace function. However it has much less functionality in
comparison to full-scale editors.
Taking this idea I decided to make a Notepad editor in Java. It
was a tough program to create but I did take help from my
brother and referred many a books and looked up many
commands to get it working.
Before one sees the Program or screenshots one must know
what all commands and variables used in the program; so
keeping in that mind here is a list of all the commands and
variables:
Integer Variables:
int styleChoice : Gives user the choice of Style of Font
int sizeChoice : Gives user the choice of Size of Font
int findIndex:
replace that
Finds a certain part in the program or
int result:
Gives an output when quitting the
program or dialog box
int returnVal:
Gives a result to the program
int lineNumber: Limits the number of lines
int index:
Helps to find a part of the program
int I
int s
int caretPosition
String Variables
String size
String options []
String selection
String clipString
String str
Global Variables
String[] styleNames
String fontChoice
String searchString
String s2
String s1
String s
String[] styleNames = {"Plain", "Bold", "Italic", "Bold
Italic"}
String options[] = { "Save", "Don't Save", "Cancel" }
String options[] = { "Yes", "No" }
Boolean Variables:
boolean fileContentModified: It helps modifying certain
functions
EventListeners implemented in the Program:
ActionListener
Interface is used for handling action
events
KeyListener
Interface is used for handling key events
AdjustmentListener
The listener interface for receiving
adjustment events.
DocumentListener
Interface for an observer to register to
receive notifications of changes to a text
document
UndoableEditListener
Interface implemented by a class
interested in hearing about undoable
operations.
ChangeListener
Defines an object which listens for
ChangeEvents.
ItemListener
The listener interface for receiving item
events. The class that is interested in
processing an item event implements this
interface.
WindowListener
The listener interface for receiving
window events. The class that is
interested in processing a window event
either implements this interface or
extends the
abstract WindowAdapter class
MouseListener
The listener interface for receiving
"interesting" mouse events (press,
release, click, enter, and exit) on a
component
Imported Classes:
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
import java.awt.datatransfer.*;
import java.io.*;
import java.net.*;
import java.text.MessageFormat;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.plaf.metal.*;
import javax.swing.undo.*;
import javax.swing.text.*;
import javax.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;