Inspiration

weaverchurchΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 4 χρόνια και 11 μήνες)

233 εμφανίσεις





Inspiration







After the dryness of Assignment 1, the Java officials have decided that its time to turn on the
‘hot’ water. Well, don’t worry; we won’t be giving you to code
NetBeans
….well, maybe just a
part of
NetBeans
. All of you
must be

familia
r with the famous
NetBeans IDE for java
.

Lots
of java developers
are

using NetBeans to develop interactive java applications
. But imagine;

if one day,
NetBeans

decide to not produce this IDE any more
and we are left deprived of
its valuable services, what
would we do? Well, obviously use
some other IDE like JBuilder
etc

:P

.

But that still doesn’t stop us
from
giving you this assignment :P
Hopefully, it will

be
much more interesting and easier than the last one.







The problem statement is quite simple:

You have to implement a
Java IDE

in your favorite
language
,

JAVA. But you won’t have to include all the functions found in a professional
Java
IDE
. The requirements list will let you know the features required for you to include.


But first
,

what we want
you to learn from this assignment:


1)

To get familiar with
Java GUI Components like JButton etc.

2)

To get used to event handling
.


3)

To refer to the API as much as possible.

Please treat it as your guide book. It’s a
much more valuable resource than you might th
ink.








Assignment # 2

Java IDE


(Date Assigned:
29
/09/0
6
)

(Due Date:

0
8
/10/0
6

1
1:59
pm
)


Inspiration


Problem Statement







Below you will see a

prototype of the
Java IDE

we

need you to implement.

It is NOT necessary that you follow this exact style or format of the GUI. You may be
creative and place the buttons anywhere you like

and m
ay use any color schem
e
. But all the
features should be present and if your GUI is not intuitive enough then you might lose

marks. So, keep it simple.


EXTREMELY IMPORTANT POINT:

You MUST include image icons on the ‘
New
, ‘
Open’
, ‘
Save’
, ‘
Search
’, ‘
Run
’, and ‘
Compile

buttons

e
tc
. Refer to the API to see how JPEGs can be imported onto the button surface.
You may use any appropriate picture you like.








The Graphical User Interface (GUI)








There should be an option of creat
ing a new java file in your IDE
.A screen will
appear which will ask the user to e
nter the name of class, whether user want to auto
generate the main function or not for this class.

After giving this information user
will press OK button and the file will be saved with the name of the class
specified
and with the extension of .java in t
he current working folder.

The current working
folder will be specified by the user when your application will start.

User will be able
to change the current working folder as well.

This current working folder will also be
stored on a file. So, that if the

user open your IDE second time it brings the working
folder from the file initially.

This option will also clear the code pane and generate
the basic class
structure
which includes class definition, con
s
tructor and main
function if specified to auto gener
ate.






This option will save the currently open file in the code pane.

This option should be
disabled when there is no open file.

There are two possibilities of saving a file. Either
saves a new file or an existing file. In case of new file you will
si
mply
create new file
and then save the code in it.

In the other case you will overwrite the already existing
file with the latest changes in the code pane.










User should be able to open
any file from the File Pane.

All the java file
s
,

which are
loc
ated in the current working
directory,

will be loaded in the file pane. N
ote that
only the name of the files will be displayed in a list in the file pane. Whenever user
double clicks
any file in the file pane it will be loaded in the code pane.











You all will be aware of this option but still if some one doesn’t know about this
then read the following text.
When user presses the search button a dialog will
appear with a textbox and
three

buttons. A textbox will be used for the text to search
within

the currently open code file.

Then, there will be a button find next
,

which will
find the next occurrence of the searched text
.

Another button called replace will
Fe
ature List


(1)
Create New File


(3
)
Open File
/File Pane


(4
)
Find & Replace


(2)
Save File


replace the current occurrence of the searched text.

Finally, there will be a button
replace

all which will replace all the occurrences of the searched text.







You are required to show the line number of the current cursor position in the code.

Whenever
,

the current cursor position changes vertically
,

the line number also
change.
So, you nee
d to keep track of UP and DOWN keys, and mouse cursor for
displaying the current line number.






As this is the IDE of java so it needs to know which will be your startup file

for
running a java program
.

From the file pane user will select the startup f
ile which will
be used as a driver file to run the java program.

If no start up file is specified then
user should be able to run the program.





This is the space where any kind of messages either success or failure/error message
will be displayed.

When

user compile or run the program it will give appropriate
messages. Like if a java file has some compile errors then those must be displayed in
the message pane.

Similarly, warning and success messages will be displayed.





Compilation is the basic need
of any java IDE. So, it is required here as well. You
need to compile either a single or all the java files present in the working folder. In
case of single file compilation user will specify which file to compile. Whereas, in
case of all file compilation
all the java files present in the working directory will be
compiled.

Any compile errors generated will be displayed in the message pane.





The java IDE is not complete with the option of running a java program.

So, you
need to provide this facility as
well.
This will execute a java program and
any warning
or
runtime
exceptions will be displayed on the message pane.

To run a java program
there must be some startup file or driver file which will be executed.

Otherwise, this
option will be disabled.

(5
)
Display Line Numbers

(6
)
Set Startup File


(7
)
Message Pane

(9
)
Running a Java Program


(8
)
Compilation of Java Program






You may use the JMenuBar to make a menu bar or if you want, you can simply
create a series of buttons. But remember, the

looks


of your GUI do count in this
assignment.



Some functions have already been mentioned above but I’
ll list them here again.
IMP
ORTANT POINT: All the following functions need to be ‘persistent’ in nature
i.e. if I close the browser and open it up again, my settings should not be reset

to
default
.
(Hint: maintain a file)


a)


JDK Path


User will specify the path of JDK where it is lo
cated
.
(You
MUST check that the user doesn’t enter a blank input)
. This path will be
used to compile and run java programs.

b)


Working Directory



User will specify the current working directory which
have all the required java files in it.

These files will

be loaded into the file
pane list.


c)


New File




User will be able to create a new file.

d)

‘Save File’


User will be able to save a new or existing file.

e)


Exit




This will quit your java IDE


You can
put
any thing in menu bar from the above functionality
.





When user compiles a program and if there is an error on the currently open file
then the first line on which error occurred will be highlighted. This will make
tracking of errors easy for the user.

(10) Menu Bar


(12
) Highlight Error Line No










As you would have seen that most of the

Programming
language IDEs provides

intellisense. Intellisense actually means when you type a “.” key then corresponding
object functions and members are visible and you can select that to type
automatically. Don’t worry we are not asking you to do impleme
nt this thing.
Instead, you are required to display a pop up which has the link of java docs. And
when user clicks that link the java docs will open.






If the user

is at an opening bracket of any structure like class, function etc then its
correspondin
g closing bracket should be highlighted automatically.

For reference you
can see NetBeans IDE how it works.


I would recommend that you first set up the whole GUI before you start up tackling the
fun
ctions. Remember to isolate
your

Presentation


Layer

(th
e class that displays the GUI)
from all your business logic.





Thats all for now, folks. Hope you find this assignment interesting. And to avoid last minute
calamities


START EARLY.


All the very best!!



Intellisense


Bonus
Feature List


Highlight Closing Bracket





Requirements

Percentage

Create New File

1
0

Save File

5

File Pane/Open File

5

Find & Replace

10

Display Line Number

5

Set Startup File

5

Message Pane

5

Compilation of Java Program

10

Running a Java Program

10

Menu Bar

10

Highlight Error Line Number

10

GUI Design

5

Java Docs/Commenting

5

Code Design/ Class usage

5

Intellisense(BONUS)

5

Highlight Closing Brackets(BONUS)

5










Grading Sche
me