CS 1713 Week 10:
Miscellaneous Topics

Objectives:

Activities:

Reading: 3.8, 4.8 - 4.9, 7.10 - 7.11


Unfinished Business

You can practice tracing selection and insertion sorts using the sorttrace project here.

Wrapper Classes

Find the notes on wrapper classes here

ArrayLists

Find the notes on ArrayLists here

Graphics Case Study 5: Using an ArrayList

In this case study we will convert Graphics Case Study 4 to one using an ArrayList instead of an array.

Start with a copy of Graphics Case Study 4. Change the project to gcs05 and change the package name to arraylist.
In this case student we used an array to hold the list of shapes. As new shapes were added, we kept track of how many shapes were stored in the array, and made the array bigger as needed.

In this case study we will use an ArrayList instead. We no longer need to keep track of the number of shapes since the ArrayList does this for us.

Layouts

Find the notes on layouts here.

Graphics Case Study 6

In Graphics Case Study 5, the buttons were contained in the main panel using a FlowLayout. We would like to isolate the buttons so that they are in their own panel, distinct from the panel that we draw into.

Copy Graphics Case Study 5 into gcs06 and change the package name to layouts.

Modify this so that the buttons are on a separate panel that does not overlap with the drawn shapes.

Ideas:

Listeners

3 ways to implement an ActionListener: