Last change
on this file since 0b84f13 was ebd3538, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 6 years ago |
Initial commit. This codebase for the Lost Perception game was created by decompiling code from a jar file.
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
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(final String newName, final int newX, final int newY, final int newWidth, final int newHeight) {
|
---|
11 | super(newName, newX, newY, newWidth, newHeight);
|
---|
12 | this.max = 1;
|
---|
13 | this.current = 0;
|
---|
14 | }
|
---|
15 |
|
---|
16 | public int getMax() {
|
---|
17 | return this.max;
|
---|
18 | }
|
---|
19 |
|
---|
20 | public int getCurrent() {
|
---|
21 | return this.current;
|
---|
22 | }
|
---|
23 |
|
---|
24 | public void setMax(final int max) {
|
---|
25 | this.max = max;
|
---|
26 | }
|
---|
27 |
|
---|
28 | public void setCurrent(final int current) {
|
---|
29 | this.current = current;
|
---|
30 | }
|
---|
31 |
|
---|
32 | @Override
|
---|
33 | public void draw(final Graphics g) {
|
---|
34 | g.setColor(Color.black);
|
---|
35 | g.fillRect(this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
---|
36 | g.setColor(Color.blue);
|
---|
37 | g.fillRect(this.getX(), this.getY(), this.getWidth() * this.current / this.max, this.getHeight());
|
---|
38 | g.setColor(Color.red);
|
---|
39 | g.drawRect(this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
---|
40 | }
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.