Paint.java

Go to the documentation of this file.
00001 
00012 import java.awt.*;
00013 import java.util.*;
00014 
00019 abstract class Paint
00020 {
00021 
00027   public static void showArray(int[] aArray, Panel aPanel)
00028   {
00029     Graphics g = aPanel.getGraphics();   //get the graphical context of the panel
00030     Color lc = new Color(0,255,0);       //new green color
00031     Color bc = new Color(128,128,128);   //the background color
00032 
00033     for (int i=0; i<210; i++)
00034     {
00035       g.setColor(lc);
00036       g.drawLine((i+20),190,(i+20),(190-aArray[i]));  //draw a vertical green line, the lenght of this line depends on the integer value in the array at index i
00037       g.setColor(bc);
00038       g.drawLine((i+20),(190-aArray[i]),(i+20),10);  //draw a vertical line in background color
00039     }
00040 
00041     aPanel.validate(); //repaint the panel
00042   }
00043 
00044 }
00045 

Generated on Thu Jun 22 19:07:31 2006 for Doxygen Example (Java) by  doxygen 1.4.5