Last change
on this file since a5b4186 was a5b4186, checked in by dportnoy <dmp1488@…>, 17 years ago |
[svn r36] Renamed remotely
|
-
Property mode
set to
100644
|
File size:
886 bytes
|
Rev | Line | |
---|
[a5b4186] | 1 | package gamegui;
|
---|
| 2 |
|
---|
| 3 | import java.awt.Color;
|
---|
| 4 | import java.awt.Graphics;
|
---|
| 5 |
|
---|
| 6 | public class ProgressBar extends Member {
|
---|
| 7 | private int max;
|
---|
| 8 | private int current;
|
---|
| 9 |
|
---|
| 10 | public ProgressBar(String newName, int newX, int newY, int newWidth, int newHeight) {
|
---|
| 11 | super(newName, newX, newY, newWidth, newHeight);
|
---|
| 12 |
|
---|
| 13 | max = 1;
|
---|
| 14 | current = 0;
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | public int getMax() {
|
---|
| 18 | return max;
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | public int getCurrent() {
|
---|
| 22 | return current;
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | public void setMax(int max) {
|
---|
| 26 | this.max = max;
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | public void setCurrent(int current) {
|
---|
| 30 | this.current = current;
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | public void draw(Graphics g) {
|
---|
| 34 | g.setColor(Color.black);
|
---|
| 35 | g.fillRect(getX(), getY(), getWidth(), getHeight());
|
---|
| 36 |
|
---|
| 37 | g.setColor(Color.blue);
|
---|
| 38 | g.fillRect(getX(), getY(), getWidth()*current/max, getHeight());
|
---|
| 39 | g.setColor(Color.red);
|
---|
| 40 | g.drawRect(getX(), getY(), getWidth(), getHeight());
|
---|
| 41 | }
|
---|
| 42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.