Developing User Interfaces
CMSC 498B
Spring 2002
Prof. Ben Bederson
Project #2
Due March 21, 2002


Purpose

The purpose of this program is to gain familiarity with Java's event facilities, including the ability to generate your own application-specific events. This is also a continued exercise in rendering your own graphics.

The Problem

You are going to create a simple text editing program with selection.  You should create a new component that provides basic functionality similar to JTextArea.  When your component has keyboard focus, it should accept keyboard events and let users type in text.  It should show a blinking text cursor that the user can manipulate with arrow keys and some simple keyboard bindings.  Furthermore, the widget should support contiguous selection with either the mouse or keyboard, and finally, the user should be able to cut, copy, and paste the text within the widget.   Finally, you should generate a custom "Selection" event that gets triggered whenever the selection is changed.  You should test this by creating a Selection listener that prints to the console a short message showing the current selection whenever it changes.  You do not need to worry about scrolling.

The requirements are:

This is a hard project.  I strongly recommend that you start immediately, as you will need the full two weeks to do a good job.

Java Hints

You can learn about javadoc at http://java.sun.com/j2se/javadoc/index.html

Submitting

Submit your program the same way you submitted project #1, by creating a zip file of all the source code files related to your project, login to a Unix WAM computer, and run the WAM submit program.  This is course CMSC 498B, Section 0101, Project #2.