Java Reference
In-Depth Information
* The low and high range values that the histogram
* corresponds to must be passed in as well. < br >
*
* @param user - bins
array of values for histogram.
* @param under
number of underflows.
* @param over
number of overflows.
* @param lo
value of the lower range limit.
* @param hi
value of the upper range limit.
**/
public void pack (int[] user - bins,
int under, int over,
double lo, double hi) {
fNumBins = user - bins.length;
fBins = new int[fNumBins];
for (int i = 0; i < fNumBins; i++) {
fBins[i] = user - bins[i];
}
fLo = lo;
fHi = hi;
fRange = fHi—fLo;
fUnderflows = under;
fOverflows = over;
} // pack
} // class Histogram
We e xtend Histogram with several subclasses that are described in subsequent
chapters in the Web Course Te ch track but not in the topic due to space limitations.
In a demonstration program in Chapter 15 of the topic we use one of these
subclasses, HistogramAdapt ,which widens its range dynamically so as to
include all data entries with no under or overflows.
6.12 Web Course materials
The Web Course Chapter 6: Supplements section includes an introduction to
basic AWT user interface design (as opposed to the Swing emphasis here). It also
looks at drawing with the Java 2D methods. A more detailed description of the
composting rules, for example, is provided as well.
The graphical interfaces shown here are only intended to demonstrate the
basic programming techniques and look rather crude. Swing, in fact, provides a
number of optional features, such as a selection of borders for components, to
 
Search WWH ::




Custom Search