Getting Started with UNIX and BlueJ

CS 160 Laboratory Exercise

Jan 30, 2001

Your Name: __________________________________________________

Your esus e-mail address: _______________________________________




The objective of this laboratory session is to give you opportunity to resolve any questions you may have regarding basic use of UNIX and BlueJ, and to test a simple BlueJ program.

Part I

Print this page and circle the answers to the following questions (if you read this before your laboratory session, you can do this ahead of time):

  1. Yes   No  I can log on to esus with my own account and password information

  2. Yes   No  I have a personal web page that can be accessed by anyone on the Web

  3. Yes   No  I understand HTML well enough to do simple web pages

  4. Yes   No  I can use PICO to edit information on esus

  5. Yes   No  I can use PINE to read my e-mail on esus

  6. Yes   No  I understand how to use Blue J for typing, editing, building, and running programs.

  7. Yes   No  I can do the simple Java programming problems associated with the class to date.

  8. Yes   No  I can run example programs from the textbook and know how to add textbook classes such as "Person" to a Blue J project.

  9. Yes   No  I have a home computer.

  10. Yes   No  If you answered "yes" above,  have you successfully installed Blue J?


If you answered "No" to any of the questions, be sure you get all of your questions clarified.  After this day we will assume that you have no major problems with your Unix account, simple HTML and Web pages, Blue J, and simple Java programs.


Part II

An important aspect of using objects is that we need to know only the interface that they present to us as programmers. Quite complicated algorithms can be hidden behind hopefully simple interfaces. For example, BasicGraphics is a class provided with the textbook.  This will allow you to display a window on the computer screen containing shapes of different kinds, sizes, positions and colors.

Before you can use an object, you have to know something about its behavior. The BasicGraphics class draws an area 600 units (or "pixels") wide by 400 units high, with the origin (0,0) at the top left-hand corner of the area.

  1. First, download and unzip the file  You should save the uncompressed folder in the Blue J directory.
  2. Open the TestBasicGraphics project in Blue J and compile it.
  3. Run the program by selecting the "main" method for the "TestBasicGraphics" class.
  4. Study the source code of the program to see how to use the BasicGraphics methods.

Once you have understood how to use these methods, do the following:

(a) Using Blue J interactively, create a BasicGraphics instance, specify a single red square centered at (200, 200) with side 60, and display it.  (Note: you must specify the color using the full color name (e.g.

(b) Modify the source code of the program to display three different shapes of your choice, each with different colors.


Before you leave you must:

  1. Discuss any of your "No" response with the TA or lab consultants.
  2. Have the TA or lab assistant view the graphics output from Part II.  In order to receive credit, you must have them sign below:

        GRAPHICS CHECKED BY:  ___________________________________________________

  3. Turn this page into the TA (so that we have feedback about what topics need further explanation).