The Bill Data class is mostly just a data structure for encapsulating attributes associated with individual billboards. It contains three variables. The first variable stores the URL to which the billboard is a link. The second variable has an Image that the applet uses to draw on the scr~ The third variable includes a pixel array of the Usage in . RGB format. The pixel array is used-by transitions in combination with another Bill Data pixel array to create the cells fort ranslt ioner, The array is one-dimensional .. The pixels in it are arranged in such a way that the first element in this array is the top-left corner of the image, The second element is the pixel just to the right of this corner. Elements that follow are the pixels to the right of this one and so on, until the rightmost pixel is reached. Then the leftmost pixel on the next line of the image used. . This continues until the last index in the array, which corresponds to the pixel on the bottom-right corner of the image. You might notice that Robert has made all of the variables in this class public. Normally, it is good. programming practice to hide the data members that should be ·read only by other classes, This is done by making them protected or private and then ·creating functions to return references to the variables. Unfortunately, in Java this . increases the size of the compiled bytecode even when the one line function is made final and the code is compiled with optimizations. So to make the applet smaller and . hence laster to download, Rob. ert made. the data members public.

[vfb id=1]

Share This