Lab 9 Comp 170-201 -- Dordal/Nabicht -- Wed, October 30, 2002 Final version due Mon Nov 4 In this lab you will convert the Scribble program from using ArrayLists to using arrays. All changes will take place to the ScribblePanel class. There are three issues with using arrays: * they are fixed size; you will have to decide what to do when the array runs out of space. Having the program just stop drawing would be acceptable. In the sample file, I have defined private final int SCRIBSIZE = 300; // # points per scribble private final int NUMSCRIBS = 20; // number of scribbles Any one scribble can thus have at most 300 points, and the entire diagram can have at most 20 scribbles. * You need to keep track of the part of the array that is actually used. While working on one scribble, you need to keep track of the fact, for example, that you're at point 54, and array slots 55-299 are unused. You can either do this by keeping a "size" value somewhere in a numeric variable, or by making sure that the unused parts of each array contain the value "null", and checking for that. * Each scribble is an array of Points, and the whole works will be an array of scribbles, that is, an array of arrays of Point. Start by copying the files Scribble.java and ScribblePanel.java from my web page. These files include the necessary array declarations, but the arrays aren't used. Note that, when using arrays, no type casting is needed to get the correct type when you take data out of the array. As with the ArrayList implementation, we will have a single array representing the current scribble, Point [] currentScribbleA; and also an array of such arrays representing the set of all scribbles: Point[] [] ScribblesA; The number of entries in ScribblesA can be represented by int scribcount; that is, ScribblesA[0]..ScribblesA[scount-1] are valid, and that last one is currentScribbleA. You don't actually have to use scribcount; you can just note that entries at or beyond scribcount in ScribblesA will be null. For each individual scribble, we also have to keep track of how many points are in it; for the scribble ScribbleA[i]. I've declared scribsizes[] to be an array of ints of size NUMSCRIBS; you can either put the number of Points of ScribbleA[i] into scribsizes[i], or note that entries beyond the end of the scribble will be filled by null. (In the latter case you wouldn't use scribsizes at all.) Here's what you'll have to do: 1. Replace drawScribble(ArrayList s, Graphics g) with void drawScribbleA(Point[] s, int size, Graphics g); You'll call this from paintComponent as drawScribbleA(ScribblesA[i], scribsizes[i], page); or else, if you're using nulls to keep track of the end of the scribble, leave out the size. In that case, the body of drawScribbleA might look like: if (s[0] == null) return; Point prev = s[0]; while (i