The instructor's version of homework #3 consists of one source file, SwingTest03.java. The program makes use of an inner class, ShapeEntry, which encapsulates the generation and painting of a random Shape2D subclass.
The program conforms to the assignment with the following minor differences:
Here is a sample compile, javadoc, and run of the program.
D:\CIS370\code>javac -d classes -sourcepath sources sources\com\bozoid\cis37 0\hw03\*.java D:\CIS370\code>javadoc -sourcepath sources -d docs/hw03 com.bozoid.cis370.hw03 Loading source files for package com.bozoid.cis370.hw03... Constructing Javadoc information... Standard Doclet version 1.4.0 Generating docs/hw03\constant-values.html... Building tree for all the packages and classes... Building index for all the packages and classes... Generating docs/hw03\overview-tree.html... Generating docs/hw03\index-all.html... Generating docs/hw03\deprecated-list.html... Building index for all classes... Generating docs/hw03\allclasses-frame.html... Generating docs/hw03\allclasses-noframe.html... Generating docs/hw03\index.html... Generating docs/hw03\packages.html... Generating docs/hw03\com\bozoid\cis370\hw03\package-frame.html... Generating docs/hw03\com\bozoid\cis370\hw03\package-summary.html... Generating docs/hw03\com\bozoid\cis370\hw03\package-tree.html... Generating docs/hw03\com\bozoid\cis370\hw03\SwingTest03.html... Generating docs/hw03\serialized-form.html... Generating docs/hw03\package-list... Generating docs/hw03\help-doc.html... Generating docs/hw03\stylesheet.css... D:\CIS370\code>java -cp classes com.bozoid.cis370.hw03.SwingTest03 paintComponent()... ShapeEntry[name=Rectangle2D 0,color=java.awt.Color[r=170,g=92,b=33],bounds=(x=659,y=360,w=45,h=35)] ShapeEntry[name=Ellipse2D 1,color=java.awt.Color[r=164,g=160,b=102],bounds=(x=524,y=330,w=430,h=128)] ShapeEntry[name=Rectangle2D 2,color=java.awt.Color[r=68,g=107,b=253],bounds=(x=93,y=279,w=293,h=318)] ShapeEntry[name=Line2D 3,color=java.awt.Color[r=183,g=33,b=192],bounds=(x=236,y=452,w=515,h=112)] ShapeEntry[name=RoundRectangle2D 4,color=java.awt.Color[r=29,g=152,b=116],bounds=(x=310,y=15,w=265,h=314)] ShapeEntry[name=Rectangle2D 5,color=java.awt.Color[r=253,g=248,b=30],bounds=(x=211,y=119,w=148,h=133)] ShapeEntry[name=Rectangle2D 6,color=java.awt.Color[r=112,g=186,b=61],bounds=(x=286,y=175,w=494,h=290)] ShapeEntry[name=Ellipse2D 7,color=java.awt.Color[r=208,g=164,b=85],bounds=(x=510,y=336,w=196,h=271)] ShapeEntry[name=Rectangle2D 8,color=java.awt.Color[r=189,g=154,b=65],bounds=(x=396,y=-3,w=57,h=229)] ShapeEntry[name=RoundRectangle2D 9,color=java.awt.Color[r=205,g=51,b=142],bounds=(x=354,y=67,w=390,h=211)] ShapeEntry[name=RoundRectangle2D 10,color=java.awt.Color[r=80,g=11,b=104],bounds=(x=510,y=193,w=154,h=266)] ShapeEntry[name=Ellipse2D 11,color=java.awt.Color[r=252,g=116,b=0],bounds=(x=147,y=-5,w=227,h=99)] paintComponent()... paintComponent()... paintComponent()... paintComponent()... D:\CIS370\code>
And here are some screen dumps of the program in action: