JavaEyes
Work on this exercise by yourself,
but ask questions of your instructor, student assistants and classmates as desired.
Goals
The goals of this exercise are to:
- Continue to familiarize you with our development environment
(Eclipse)- Ensure that you can read and modify Java code
- Make sure that you are clear on very basic OOP structural elements
- Introduce you to checking out projects that are already under Version Control
The Exercise
You will check out a simple GUI program named JavaEyes from a central
repository using Subclipse.
You will read the program, answer some questions about it, and modify it.
You will check your modified version back in using Subclipse.
Instructions Part 1 - Check Out the Project
- Open Eclipse. Switch the the SVN Repository Exploring perspective
by choosing Window ~ Open Perspective ~ Other...,
choosing SVN Repository Exploring, and
clicking Open
-
You'll get an SVN Repository view where your Package Explorer usually lives. Right-click in that view and select
New ~ Repository Location...
-
In the
Add SVN Repository
dialog box, enter:
-
URL:
http://svn.cs.rose-hulman.edu/repos/<your username>
.
-
Enter the username and password that your instructor gave you (not
your Kerberos/network password).
-
Eclipse should bring up this location in the SVN Repository view. If not,
get help now.
-
Right-click on JavaEyes and select
Check Out... → Checkout As Project in the Workspace
and choose Next to select default name.
-
To work on the project, go back to the Java perspective (choose
Window ~ Open perspective ~ Java).
-
Consider:
Checking out JavaEyes changed your Project Explorer view. (It may also have changed your Problems view, since JavaEyes intentionally has some errors.) How is your Project Explorer view different than it was before you checked out the JavaEyes project?
Instructions Part 2 - Read the code
- Run the program and play around with some of its features.
- There are a few written questions about JavaEyes on
Homework 1. Use the Package Explorer to answer the first few questions now.
Instructions Part 3 - Modify the code
- Find the code that declares the eye (not eyeball) color. Change it to another (non-blue) color of your choice.
Note that Eclipse has a great code completion feature that does much of the typing for you!
- Eclipse compiles on-the-fly. This means it can find compile-time errors automatically for you and suggest fixes.
It also means that you never need a separate "build" or "compile" step before you run.
- Notice that an error message occasionally shows up in the console. Find and
remove the source of this error (while keeping the rest of the program intact).
- Add a third eye that behaves just like the other two.
- One of the written problems on
Homework 1 asks you about how you'd change the design of JavaEyes to add an eye
that moves independently of the others. Please implement that design now, that is, write the code to do this.
What you have the fourth eye do is up to you, depending on your experience and
interest. Simplest is to have it just be static. More challenging and fun is for
it to continually roll around clockwise, but feel free to show off your
creativity!
Instructions Part 4 - Check the Project Back In to the Repository
If you created any new classes, you need to right-click on them in the Package Explorer, and choose Team → Add to Version Control
Right click on the JavaEyes project in the Eclipse Package Explorer, and choose Team → Commit...
You should noticed that the checkbox of any files you added are marked; if
not, do so now.
Include a useful (or fun?) log comment.
Make sure any new files you want to add have a check next to them.
After you choose "OK" you should see log file notes in the Eclipse console window that verify your success.