source: java-rpg-client/gamegui/ProgressBar.java

Last change on this file was 55522be, checked in by dportnoy <dmp1488@…>, 17 years ago

[svn r8]

  • Property mode set to 100644
File size: 886 bytes
RevLine 
[55522be]1package gamegui;
2
3import java.awt.Color;
4import java.awt.Graphics;
5
6public 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.