They have decided that their earlier command line application limited the size of the potential market. So, for this assignment, you must implement a GUI. However, to keep things simple, it need only work with courses that have a particular structure (specifically, the original course structure, now known as course structure 1).
The team decided not to write acceptance criteria for this sprint, but instead to write use case descriptions that describe the features. They then wrote specifications from the use case descriptions.
Gradient
class for this Sptint
CategoryField
class
GradientWindow
class
LeafGradeField
class
LeafGradeField
class.CategoryField
class.GradientWindow
class.JComponent
Border
TitledBorder
Border
interface that includes a
String
. The best way to create an instance is to use
the static method
BorderFactory.createTitledBorder(java.lang.String)
getMaximumSize()
method (e.g., have it
return getPreferredSize()
or getMinimumSize()
) to prevent
LeafGradeField
object's from being made arbitrarily
large. You also may want to set the column width of
the LeafGradeField
objects.
Also, to improve the usability, you may want to have
the LeafGradeField
class realize
the FocusListener
interface and
select the contents when focus is gained (and un-select the contents
when focus is lost) so that the current contents can be easily
overwritten.
CatageoryField
objects.
The most obvious is to use a
horizontal BoxLayout
(or to do so
indirectly using a
Box
constructed
using a factory method).
After adding all of the
LeafGradeField
objects you
can then add "glue" that will occupy all of the remaining horizontal
space. Of course, this only works if the LeafGradeField
objects aren't able to be arbitrarily large (as discussed above).
The simplest is to use
a GridLayout
. The disadvantage of this
approach is that the
LeafGradeField
objects will be
sized so that they occupy the available space. One inelegant way
around this is to add extra JLabel
objects (on the right).
The most complicated, though perhaps the most flexible, is to use a
GridBagLayout
and set the
GridBagConstraints
for each
LeafGradeField
object so that they don't "fill"
extra space (i.e., set the fill
attribute to
NONE
and the weightx
and weighty
attributes to 0). Then, add a JLabel
as a "filler"
(i.e., set the fill
attribute to
HORIZONTAL
and the weightx
and weighty
attributes to 100).
The advantage of this approach is that it will work even if
the LeafGradeField
are able to be arbitrarily large (as discussed above).
GradientWindow
objects.
The simplest is to use a vertical
BoxLayout
(or to do the same thing indirectly using
a Box
constructed using a factory method). After
adding all of the CategoryField
objects you can then
add "glue" that will re-size to occupy all of the vertical space
that they don't need.
It is also possible to use a GridLayout
or a GridBagLayout
.
.pdf
file containing two "screen
shots". One "screen shot" must show the GradientWindow
and the course grade dialog for the grades
in
potterhj-cs111.grd
.
The other "screen shot" must show the
GradientWindow
and the course grade dialog
for the grades in
cs111.grd
. (Hint: The easiest way
to create one .pdf
file containing the two "screen shots"
is to paste the "screen shots" into a word processing document and then
create a .pdf
file from the word processing document.)
You must also submit (to the "H6_Java" assignment on Gradescope)
a .zip
file (named sub6.zip
) containing
all of the code necessary to compile your
GradientWindow
class (i.e., the gui
package, the grading
package, and
the grading.io
package. Do not submit
the app
package or any test-related packages.
Gradescope will only be checking to ensure that your code compiles
and complies with the course style guide. Hence, you may only
submit your code to Gradescope five times. If you can't get your
code to comply with the course style guide within five submissions
(something you should be able to do at this point), you will receive
a grade of 0 on the assignment.
The Gradescope autograder will assign a maximum grade of 25 (based solely on style). Points will then be awarded manually based on the criteria discussed in the previous paragraph.
Copyright 2025