Due: 5:00pm, Friday, September 19. Value: 30 pts.
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 that manages the list of windows available in a simple
simulation of an overall user interface. We'll use a doubly
linked list to track the list of windows
In the provided user interface, the display is the gray area at the top of the application. The white text area below is a log of what has happened, there to help with debugging.
When the application is working, you will be able to interact with windows in a variety of ways.
Distributed with this assignment are three 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
Provides the overall application, including the main method.
Your assignment is to complete four crucial Manager
methods for managing the list of windows. The only instance
variables in Manager
should be references to the
top and bottom window on the simulated screen.
void add(Window toAdd)
toAdd
to this window list so that it appears at
the top.void remove(Window toRemove)
toRemove
from this window list.Window find(int x, int y)
null
if no
windows contain the point.void paintAll(Graphics g, Window current)
paint
method, passing the g
parameter to it and a
boolean parameter indicating whether that window is
current. You don't need to use the parameter g
except to hand it to each individual window.You want to use the following instance methods
from Window
.
boolean contains(int x, int y)
true
if
(x
, y
) lies within this window's
boundary.void paint(Graphics g, boolean selected)
g
. If
selected
is true
, the window is drawn
with a thick border.Window getWindowAbove()
Window getWindowBelow()
void setWindowAbove(Window value)
void setWindowBelow(Window value)