package gamegui; import java.awt.Color; import java.awt.Graphics; public class ProgressBar extends Member { private int max; private int current; public ProgressBar(final String newName, final int newX, final int newY, final int newWidth, final int newHeight) { super(newName, newX, newY, newWidth, newHeight); this.max = 1; this.current = 0; } public int getMax() { return this.max; } public int getCurrent() { return this.current; } public void setMax(final int max) { this.max = max; } public void setCurrent(final int current) { this.current = current; } @Override public void draw(final Graphics g) { g.setColor(Color.black); g.fillRect(this.getX(), this.getY(), this.getWidth(), this.getHeight()); g.setColor(Color.blue); g.fillRect(this.getX(), this.getY(), this.getWidth() * this.current / this.max, this.getHeight()); g.setColor(Color.red); g.drawRect(this.getX(), this.getY(), this.getWidth(), this.getHeight()); } }