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
you should not modify the other classes.
Represents a single rectangular window.
Manages the current list of windows.
Provides the overall application, including the main method.
Your assignment is to complete four crucial
methods for managing the list of windows. The only instance
Manager should be references to the
top and bottom window on the simulated screen.
void add(Window toAdd)
toAddto this window list so that it appears at the top.
void remove(Window toRemove)
toRemovefrom this window list.
Window find(int x, int y)
nullif no windows contain the point.
void paintAll(Graphics g, Window current)
paintmethod, passing the
gparameter to it and a boolean parameter indicating whether that window is current. You don't need to use the parameter
gexcept to hand it to each individual window.
You want to use the following instance methods
boolean contains(int x, int y)
y) lies within this window's boundary.
void paint(Graphics g, boolean selected)
true, the window is drawn with a thick border.
void setWindowAbove(Window value)
void setWindowBelow(Window value)