Creating "Nifty" Assignments for Java Programming Courses
and a Discussion of the Necessary Aspects of Java |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
Graphical User Interfaces
JFrame
The "Graph Paper" Approach
JButton
ObjectsActionEvent
ActionListener
void actionPerformed(ActionEvent event)
JButton
Objects (cont.)Two-Dimensional Graphics
The (Linear) Color Cube
Graphics2D
ObjectShape
Interface
setFont
method in
Graphics2D
Line Metrics
The x
and y
passed to
drawString(String s, float x, float y)
are the left end
of the baseline.
public void paint(Graphics g)
methodJComponent
which does very little in its
paint()
method
The Dashboard Revisited
Animation
An Illustration
Timer
object that sends
actionPerformed()
messagesActionListener
on the Timer
that updates state information each "tick"JComponent
that renders itself using the
state information
Fish
Class
FishTank
Other Examples