public class BSortDisplay implements SortDisplay
1:
2: import java.awt.*;
3:
4: public class BSortDisplay implements SortDisplay {
5:
6: public int getArraySize(Dimension d) {
7: return d.width / 2;
8: }
9:
10: public void display(int a[], Graphics g, Dimension d) {
11: g.setColor(Color.white);
12: g.fillRect(0, 0, d.width, d.height);
13: double f = d.height / (double) a.length;
14: int x = d.width - 1;
15: g.setColor(Color.black);
16: for (int i = a.length; --i >= 0; x -= 2)
17: g.drawLine(x, d.height, x, d.height - (int)(a[i] * f));
18:
19: }
20: }
21: