Please send questions to st10@humboldt.edu .

CIS 480 - Spring 2001
HW #3
Due: Monday, February 26th, 2001, beginning of lecture

(note the expanding minimum style standards at the end of this homework
handout!!)

You need to write 4 distinct, different Java programs for this
assignment.

If you meet the minimum requirements below, that up to 90% credit.  If
you do something interesting in these programs, that's how you can
get up to 100%. Note that the possibilities given below do count as
"interesting" in this sense.

1. Write a Java GUI application or applet that uses just the AWT, and:
        *   includes at least one button;
	*   includes at least one textfield;
	*   includes at least one label;
	*   does NOT involve any painting;
	*   at least one of those buttons/textfields is sensitive to
	user action, and does something obvious in reponse to that
	action; (for textfields, avoid use of a text listener --- use
	of an action listener for a textfield should be fine.)
	*   has a relatively pleasing layout;
	*   does something different from the in-class examples;

	*   (if you do an applet, you *must* include its recommended
	size in the opening comment block for that applet;)

	*   be careful! You'll be converting this to Swing in #2,
	so don't use any components you don't want to try Swing
	versions of yet... 8-)

	*   name your application/applet Hw3Num1.java

	*   some possibilities:
	        *   allow users to enter top and bottom of a range
		within textfields, and whenever a button is pushed, 
		a random number within that range appears in 
		another textfield; use labels to explain to
		users what to do.

		*   ask users to type a string in a textfield,
		and whatever is in that textfield becomes the
		text of a label whenever a particular button
		is pushed; another button clears the textfield and
		resets the label's text to its original text.		

2. Now, modify your #1 so that it uses Swing components. No AWT
*components* are permitted for this part (but, as we have discussed,
you will of course still use AWT layout managers, fonts, colors, etc.)
        *   name your application/applet Hw3Num2.java

	*   (if this is a JApplet, remember to include its 
	recommended size in its opening comment block here, also)

3. Write an applet using JApplet that is *different* from your programs
for #1/#2, and:
        *   uses only Swing components (no AWT *components*)
        *   does not involve painting;
	*   includes a Swing component for which you are using
	some feature of that component that is different (of 
	additional/extended functionality) to what you could do with
	its AWT equivalent;
	*   (remember to include its recommended size in its
	opening comment block)

	*   you decide: it can be some feature mentioned/demo'd in
	class, or one you look up yourself. But, you must do something
	different from any in-class example.

	*   name your applet Hw3Num3.java

	*   some possibilities: 
	        *   look at the Java 1.2.2 API, follow link for
		package javax.swing, and find an AWT-equivalent component
		that is of interest to you. Find out a feature that
		is different from its AWT-equivalent, and write a
		JApplet demonstrating that feature.

		*   (the point here is to encourage exploration on 
		your part --- this can be a relatively simple
		applet and still be deemed interesting, as long as
		it demonstrates a "new" feature for a Swing equivalent
		to an AWT component, in a way that is different 
		from any in-class example.)

4. Write an application using JFrame that is *different* from your
programs for #1/#2/#3, and:
	*   uses only Swing components (no AWT *components*);
	*   does not involve painting;
	*   includes a Swing component that does NOT have an
	obvious AWT equivalent.

	*   you decide: it can be some component mentioned/demo'd in
	class, or one you look up yourself. But, you must do something
	different from any in-class example.

	*   name your application Hw3Num4.java

	*   some possibilities:
		*   look at the Java 1.2.2 API, follow link for
		package javax.swing, and find a component that
		does not have an obvious AWT equivalent. Write an
		application demonstrating a simple instance of that
		component.

		*   (the point here is to encourage exploration on
		your part --- this can be a relatively simple
		application and still be deemed interesting, as long as
		it demonstrates a "new" Swing component in a way
		different from any in-class example.) 

Minimal style standards (to be added to, as necessary and as the 
semester proceeds):
        *   [NEW] Java GUI applications must always include 
	System.exit(0), and must handle window closing gracefully;

	*   [NEW] Run-time exceptions (such as, but not limited to,
	NumberFormatExceptions) should be handled gracefully
	by proper use of try-catch blocks.

	*   [NEW] Any applet (AWT or Swing) must include in
	its opening comment block its recommended size.

	*   [MODIFIED] every Java source file should begin with at 
	least a small block comment describing the purpose of what
	is within, and including your name. The user should have
	a resonable idea of how to run that source from simply
	reading the opening comment block (input/parameters expected
	and output/results should be relatively clear after
	reading that opening comment block). If you are modifying
	existing code (such as an in-class example), you should
	indicate that in your opening comment block, also.

	*   programs are expected to have at least a few
	descriptive internal comments.

	*   neat, consistent indenting is required.

	*   reasonably-descriptive and non-misleading variable
	names are expected.

Then, send four e-mails to st10@humboldt.edu as follows:
      *   each Subject: line should be the name of Java source
      contained within that e-mail message (so, one will have 
      Subject: Hw3Num1.java ... and so on to Subject: Hw3Num4.java)

      *   the *body* of each e-mail should contain the
      Java source (that is, do NOT include it as an attachment!!!)

      *   please FIX the indenting in the Java source code
      if it is ugly when placed in the e-mail body! (Source code
      pasted from BlueJ sometimes requires such clean-up.)