CSE 341 -- Assignment 4 -- Java Warmup #2

Due in lecture Nov 2, 1998. This warmup exercise will give you a bit of experience in using inheritance, and also Java's windowing and interaction techniques.

  1. Define and test a ColorEditor as described Tim Budd, Understanding Object-Oriented Programming with Java, Chapter 6 Exercise 7 (page 96).

  2. Make a subclass of ColorEditor called ColorEditorWithQuit that has a "quit" button (see exercise 4 on page 95 for a suggestion on how to do this). The new ColorEditorWithQuit class should not duplicate the code in ColorEditor, but should use inheritance and just consist of the additional code for the quit button but not a copy of the code in ColorEditor.

Hints: The code in Chapters 4-6 of the book is available from Tim Budd's web page. However, the code in the text requires Java version 1.1 or 1.2 -- it won't work with the 1.0.2 version on orcas.

If you are having trouble figuring out Question 2, you might start by just copying the ColorEditor class and modifying the code, without making a subclass, so that you get the functionality right. However, part of the purpose of this question is to have you make use of subclassing in effective ways, so the solution you hand in should be done as described, using inheritance.