Below is a method for drawing a simple progress bar:
/**
* @param g Graphics
* @param x
* @param y
* @param w width
* @param h height
* @param p part between zero and total
* @param t total
*/
void fillProgressBar (Graphics g, int x, int y, int w, int h, int p, int t) {
g.drawRect(x, y, w, h);
// p will receive the pixel width of the proportion: part / total
p = (p * w) / t;
g.fillRect(x, y, p, h);
}