FHTW Berlin

FHTW Berlin
Fachbereich 4
Internationale Medieninformatik
PROG1: Programmierung I
Wintersemester 03/04


Laboratory 13: Scribbler


 

In lab, you should write and test the code that you designed for Lab 12.

As always, you should implement your code in simple, testable stages, building on your code only as each stage works robustly. In this case, it should be as simple as following your development plan.

A few notes:

When you write the initial test class, you will find that it doesn't really exercise the drawing area. You may want to try overriding the drawing area by extending SmartCanvas and overriding its paint method. For example, you could make it draw your Japanese flag (from the finger exercises).

When you are writing your event handler(s) for SmartCanvas, you may wish to begin by drawing dots wherever the mouse is clicked. You can also try drawing straight lines (from where you press the mouse to where you release it) as a simpler case before handling full-blown scribbling.

If you have completed a Scribbler that responds to (some) mouse events, you have accomplished the basic (target) desired functionality.

Additional (Bonus) Functionality

You don't need to go beyond building a working line-drawing Scribbler. However, there are lots of bells and whistles that you can explore if you are so inclined. These include more sophisticated event handling, connecting the Choice and Button components, or even adding additional widgets of your own. One caveat: we recommend that you stay away from modifying ScribbleData. (We do, however, strongly recommend that you use ScribbleData.)

A useful method that you might want to use if you reach this stage in your program is:

 

In your report

At a minimum, your report should explain how your code handles mouse events in the drawing panel, ideally by drawing the appropriate lines. If your code does not behave as expected, you should explain why or describe what you have done to try to figure out why.

If your code does more than draw lines, you should describe and demonstrate what it does as well as how you were able to achieve this behavior.

It is always more important that you write clean, modular, well-documented and easy-to-understand code than that you go on to advanced features.

Post-Lab, AKA What To Turn In

Your completed assignment should include:


This course is an adaption for the Fachhochschule für Technik und Wirtschaft , Berlin by Prof. Dr. Debora Weber-Wulff of a part of Prof. Dr. Lynn Andrea Stein's Rethinking CS101 project produced while she was at the MIT AI Lab belonging to the Department of Electrical Engineering and Computer Science (EECS) at the Massachusetts Institute of Technology. She is now with Franklin W. Olin College of Engineering. The copyright for all materials belongs to Lynn Andrea Stein, this adaptation is used by permission. All rights reserved.
A textbook is in preparation by Morgan Kaufmann Publishers


Questions or comments: <weberwu@fhtw-berlin.de>