This homework assignment is designed to give you some experimental experience with different incremental display algorithms and a feel for how using an incremental display algorithm can improve the interactive feel of an application. Start this assignment by saving TotalRedraw.java to your directory. Compile it and run it. You should see a checkerboard background with a black rectangle on top. Try dragging the black rectangle around the display with your mouse. See how the rectangle struggles to keep up with the mouse? The reason is that I have created a 500x500 checkerboard, with most of the checkerboard displayed off the screen. TotalRedraw is drawing 250,000 rectangles with each mouse drag. If your computer is faster or slower at redrawing rectangles than mine is, try adjusting the NUM_ROWS variable up or down.
java /home/bvz/gui/hw/hw7/XorRedrawI used a line thickness of 2, a dash pattern of 10, and made the feedback rectangle be black over the white checkerboards, but you can use anything, so long as it is clear that you have a dashed line rectangle.
I do not have an example executable for this one, but your rectangle should no longer struggle to keep up with the mouse.
Unlike in class there is no property for a feedback object, so you will have to make your actions handle the following items:
Assume that you are moving Java Rectangle objects, and that the following variables have been declared for you:
Rectangle feedbackRect; // the feedback rectangle // whether or not the feedback rectangle is visible boolean feedbackVisible;Write Java code to complete the following template. Assume that the addInteractor method replaces the addListener methods in the existing code.
addInteractor(new MoveInteractor() { public void startAction(MoveEvent e) { // YOUR CODE } public void runningAction(MoveEvent e) { // YOUR CODE } public void stopAction(MoveEvent e) { // YOUR CODE } });You will put this code in either an ascii text file or in your word processor. You cannot implement it because you do not have the underlying interactor runtime environment with which to test it.