CPSC 219: Mini-Assignment #4
Due Thur Mar 31 at 4 PM
Text only connections such as Putty won't allow you to run programs that
employ graphical user interfaces. If you have been working at home to complete
assignments but haven't installed JDK on your computer then you might want to [map
your UNIX account] to a drive on your computer.You can then access all the
files on your computer science account directly from your home computer and use
whatever editor that you wish. If you open up a remote connection using Putty
then you can still compile your programs but it will be with the CPSC compilers.
Finally to run your programs you can run 'Java' locally using JRE (unlike the
JDK which includes the compiler you don't have to worry about setting the
classpath). Open up a command line on your home computer 'cmd' and use it to
navigate to where you have your GUI code on your CPSC account. (Don't forget to
change drives - the drive letter will be whatever letter that you used when you
initially mapped a drive to your UNIX account). When you type 'java
Driver' (or whatever the name of starting class is) your GUI will be run
locally on your computer.
New Concepts to be applied for the assignment
- Implementing a simple graphical user interface with common GUI controls
(JButton, JFrame)
and event handlers (ActionListener).
Overview
Everyone starts with a grade point of zero for this assignment. Implementing
each of the features below completely and correctly will award you
1.0 grade points (i.e. implementing all four features
will result in a grade point of 4.0 being awarded).
- When the program runs it will create a JFrame
containing a JButton the latter with some
default text (Figure 1): worth 1 letter step
- When the button is pressed two things will happen:
- The text of the button changes to a non-default value (Figure 2):
worth 1 letter step
- Another JFrame window appears that
contains the same non-default text contained in the button (Figure 3):
worth 1 letter step
- The close behavior for both (no credit if
you change one but not the other) JFrames
(triggered when the close window control is clicked: Figure 4) is changed
from hiding the window to the disposal of the control: worth 1 letter
step
Figure 1: Program initially run,
JFrame
contains a JButton
with default text
Figure 2: Button pressed: the text of the
button changes to a non-default value
Figure 3: Button pressed: a new
JFrame
popup (containing the same non-default text from the button) appears for each
press
Figure 4:
Clicking on the close window control (top right of the
JFrame) will
'dispose' of the control (rather than default 'hide' behavior)
External libraries that can be used
Unlike the other assignments
you will make extensive use of the pre-created Java libraries developed by
Sun/Oracle for graphical components (e.g., java.awt.,
javax.swing), event handling (e.g.,
java.awt.event) .
Points to keep in mind:
- Due time: All assignments are due at 4 PM on the
due dates
listed on the course web page. Late assignments or components of
assignments will not be accepted for marking without approval for an
extension beforehand. What you have submitted in D2L as of the due date is
what will be marked.
- Extensions may be granted for reasonable cases by the course
instructor with the receipt of the appropriate documentation (e.g., a
doctor's note). Typical examples of reasonable cases for an extension
include: illness or a death in the family. Cases where extensions will not
be granted include situations that are typical of student life: having
multiple due dates, work commitments etc. Tutorial instructors (TA's) will
not be able to provide extension on their own and must receive permission
from the course instructor first. (Note: Forgetting to hand your assignment
or a component of your assignment in does not constitute a sufficient reason
for handing your assignment late).
- Method of submission: You are to submit your assignment using D2L
[help
link]. Make sure that you [check
the contents of your submitted files] (e.g., is the file okay or was it
corrupted, is it the correct version etc.). It's your responsibility to do
this! (Make sure that your submit your assignment with enough time before it
comes due for you to do a check).
- Identifying information: All assignments should include contact
information (full name and student ID number) at the very top of your
program in the class where the 'main()'
function/method resides.
- Collaboration:
Assignments must reflect individual work, group work
is not allowed in this class nor can you copy the work of others. For more
detailed information as to what constitutes academic misconduct (i.e.,
cheating) for this course please read the following [link].
- Execution: programs must run on the computer science network. If
you write you code in the lab and work remotely using a remote login program
such as Putty or SSH. If you choose to install Java on your own computer
then it is your responsibility to ensure that your program will run properly
here. It's not recommended that you use an IDE for writing your programs but
if you use one then make sure that you submit your program in the form of
individual text ".java" files (one for each
class that you define).
- Source code: in order to get any credit for your work you must
submit all relevant dot-java files for the assignment (e.g.,
Driver.java). If you only submit your byte code
files (e.g. Driver.class) then you will not be
awarded any credit.
D2L configuration for this course
- You can (and really should) submit work as many times as you wish before
the due date
- D2L will only retain whatever files that you submitted the last time
that you uploaded to D2L, previous files will not be retained (e.g. if you
submit files: A.java, B.java, C.jpg the first
time and then you submit A.java the second time
then D2L will only have one file stored: A.java.
That means that you should submit every file associated with the assignment
each time that you want to submit something regardless of how many of those
files were actually changed since the last submission.