Supporting files:
Windows.java
Display.java
Manager.java
Window.java
Objectives:
Most graphical user interfaces are based on a stack of overlapping rectangles that we know as "windows." In this assignment, we'll create a class whose job is to manage the set of windows available in a simple simulation of an overall user interface.
When the application is working, you will be able to interact with windows in a variety of ways.
Distributed with this assignment are four classes. All are complete except the Manager class; you should not modify the other classes.
Window | Represents a single rectangular window. |
Manager | Manages the current list of windows. |
Display | Implements the display interface. |
Windows | Provides the overall application. |
Your assignment is to complete four crucial methods for managing the list of windows.
toAdd
to this window list so that it
appears on top.
Don't worry about what happens if the array is already
full.
toRemove
from this window list.
x
,y
), or null
if no
windows contain the point. Note that this windowing system,
like most, inverts the y-axis from what is
conventionally used in mathematics: The y=0 line is
at the display's top, and y increases as you move
downward.
paint
method
(passing the g
parameter to it). You don't need to
use the parameter g
in way other than to hand it to
each individual window.
windows
instance
variable, which is an array of Window objects that you should use
for storing the current list of windows. You should use the
windowCount
instance variable to remember how many
windows there currently are. Whether your array lists windows
from the bottom up or from the top down is up to you.
Your implementation will need to use the
following methods from the Window
class.
g
.