
class Mediane extends MacLib {
  static int J=300;             // la taille du tableau


    public static void bbarre (int tab[], int i) { // affiche une barre
        Rect r = new Rect();                       // bleue verticale
        foreColor(blueColor);                      // a l'abcisse i
        setRect(r,i+4,4,i+5,J-4);
        paintRect(r);
        foreColor(blackColor);
        //        try { Thread.sleep(500); }
        //        catch ( Exception e ) {}
    }

    public static void affiche (int tab[], int g, int d) {
        Rect r = new Rect();                 // affiche le contenu de tab
        setRect(r,4+g,4,d+5,J+4);            // entre g et d 
        foreColor(whiteColor);               //  
        paintRect(r);                        // affiche(t,g,g) efface
        foreColor(blackColor);               // les barres en g 
        for (int i=g; i<d; i++) {
            setRect(r,i+4,J-tab[i]+4,i+5,J-tab[i]+5);
            paintRect(r);
        }
    }


  public static void main (String argv[]) {
    int rang;                                  // le rang cherché
    if (argv.length==1) {
      rang=Integer.parseInt(argv[0]);          // on le récupère dans
                                               // la ligne de commande

      InitQuickDraw();                         // Initialisation 
      Rect r = new Rect(100,100,J+120,J+120);  // du graphisme.
      setDrawingRect(r);
      showDrawing();
      setRect(r,4,4,J+5,J+5);
      frameRect(r);                            // un joli cadre

        .................                       // A vous de jouer !

  }
}





