CSE 115 - Fall 2008 - Banner
UB -
University at Buffalo, The State University of New York Computer Science and Engineering
  • CSE 115 - Fall 2008
CSE 115 - Fall 2008 - Navigation
CSE 115 - Fall 2008 - Lab 5

Lab 5
Last modified: September 29 2008 05:19:08 PM

- - Lab 2

NOTE: Because of the holidays over the next two weeks, recitation meetings are scattered, please see chart below so that you know which day your recitation will meet for the next two weeks.

Introduction

In this lab, you will be writing your first Java class from scratch. You will also be learning about creating graphical programs and the layout of graphical programs. We will still be using the DrJava Interactions Pane to create instances (we'll be moving onto stand-alone programs shortly).


Objectives

We will concentrate on the following idea that was discussed in class:

  • Class definitions
  • Constructor definitions
  • JFrames and other Java swing components

There will also be a review of the following two concepts previously covered:

  • Creating objects
  • Calling methods
  • References


Lab Tasks

Eclipse Project Setup

Check out the Lab5 Skeleton from the repository. This skeleton is different than the previous two because it does not contain any Java files or packages.

Your next step is to create a Java package named lab5 in your project.

Finally, you should create a class named App in your lab5 package.

Creating the Class Definition

Your skeletal class definition should be in your App.java file. You will fill in the rest of the file so that when you create an instance of a lab5.App at the DrJava Interactions pane, you get a JFrame that looks like this:

App JFrame image

You will need to consult information about the components availabe for use in the javax.swing package, and you can do so using the content-assist features of Eclipse, or by using the online Javadocs for the swing package here.

Now create another file and class named App2 and fill in the code appropriately so that when you create a lab5.App2 at the DrJava Interactions Pane, you get a JFrame that looks like this: (note that there are two images here so that you can see what the dropdown from the menu should look like)

App2 JFrame image

App2 JFrame image with menu item showing

Note that these JFrames are not required to have the implied functionality, they must simply appear and look the same as the images shown in this description.


Due dates

The Lab5.jar must be submitted using the electronic submission command the evening before (11:59:59pm) your next lab session, the due dates are summarized in the table below.

Recitation Normally Meets on Recitation for this assignment will meet on Assignment due on
Tuesdays Tuesday, October 7 Monday, October 13
Wednesdays Wednesday, October 8 Tuesday, October 14
Thursdays Thursday, October 2 Wednesday, October 15
Fridays Friday, October 3 Thursday, October 16

 


A Note for Working at Home

If you are going to do some work from home and some work in the lab on this or future lab assignments, you should be aware that to transfer the files from one machine to another, you need to combine some steps that we've already taught you in previous labs. First, when you are done working for the day, you need to export your project and save the resulting JAR file. When ready, you will need to transfer that file to the other machine using a file transfer program. Once the file is on the new machine, you will need to import into an already-existing project (use the Lab 5 skeleton as a base for the project). You will need to do this set of steps each time you want to move the file.

CSE 115 - Fall 2008 - Footer

Page maintained by Adrienne Decker

Contact: adrienne@cse.buffalo.edu | 130 Bell Hall | (716)645-3180 x 161