CS210: Introduction to Java development Tools

Lab #1

Pre-Lab Assignment

Answer the following questions about the Sun Java Development Kit (JDK) and Dr Java in your own words.  Each answer should be 1 paragraph long.  Your answers must be printed (not handwritten).  All your answers together must fit on one side of one sheet of paper.

What are the two main component programs in the Sun Java Development Kit?  What does each of them do?

What is the difference between the filename ending with .java and the file name ending with .class?

What is Dr Java?  What kinds of things can we do with Dr Java?

Why is it easier to use Dr Java with the Sun JDK than to use the Sun JDK by itself?

Note:  The assignment is due at the BEGINNING of the lab.  You can only work on the lab once you complete the pre-lab assignment. 



This lab gives you experience working with Dr Java.  The goal of the lab is to get you started with Dr Java so you are better prepared when you begin writing your own source code in lab 2.


This lab works with a small graphics application that displays “eyes” that follow the mouse.  You will use a similar process for the other labs and projects in this course.  Your TA will lead you through the following process: 

Download, save, and unzip the file Lab1.zip on your removable media (floppy disk, Zip disk, or memory stick) creating a directory named Lab1.

Open the Dr Java Application on your PC.  You may want to see line numbers to answer the questions.  Using the menu Edit -> Preferences …   under the category Display Options, check the box labeled Show All Line Numbers.

Create a new Dr Java project in the Lab1 directory by selecting the menu Project -> New… naming the project file Lab1 and saving it in your new Lab1 directory.  (Dr Java automatically opens an Untitled file in the editor window which you will ignore.)

Using the menu File-> Open, open the file EyeballPanel.java and the file Eye.java.  Dr Java will automatically include these as source files in the Lab1 Project.  Use the menu Project -> Save to save the updated project file. 

Using the menu Project -> Compile Project, compile the files.  Dr Java invokes the Sun JDK javac compiler for you on each file in the project.

Select the file that contains the main method (EyeballPanel.java) in the sidebar window.

Using the menu Tools -> Run Document’s Main Method, run the application.   It will appear in a new Window in the upper left corner of your screen. 

Experiment with the application and read the Java source code, so you can answer the questions for the lab report.

When you are through with the lab, close the Project using the menu Project -> Close.  Be sure to remove your media and take it with you.

Before you leave, have your TA check off that you completed the lab.

Lab Report

Write a document that answers the following questions.   Your lab must be printed (not handwritten). 

Answer the following questions related to what you did in this week’s lab.

What happens when you resize the application window?

When you run the application, the window that pops up has a title.  In which file and at what line number in the code is that title set?

Line 22 of EyeballPanel.java has the statement this(20,32).  What happens when you change the two parameters of this statement?

Look in the directory you created for this project.  What are the names of the source code files?  What are the names of the byte code files?  What is the name of the other file you find there?  Open it with Wordpad and describe what you find in it, but do not edit it.

How can you make sure another CS110 student is not able to sit down at the workstation after you leave and look at your work?  (Even though that would NEVER happen ;-)

Note:  You should work alone on the lab report.

Note:  The assignment is due at the BEGINNING of your next lab.