home *** CD-ROM | disk | FTP | other *** search
- package actual;
-
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Graphics;
-
- public class Gauge extends Component {
- int current;
- int total;
- int Height;
- int Width;
-
- public Gauge() {
- this(Color.lightGray);
- }
-
- public Gauge(Color var1) {
- this.total = 100;
- this.Height = 18;
- this.Width = 250;
- ((Component)this).setBackground(var1);
- }
-
- public void paint(Graphics var1) {
- int var2 = (int)((float)this.current / (float)this.total * (float)((Component)this).getSize().width);
- var1.setColor(((Component)this).getBackground());
- var1.fill3DRect(0, 0, var2, ((Component)this).getSize().height - 2, true);
- }
-
- public void setCurrentAmount(int var1) {
- this.current = var1;
- if (this.current > 100) {
- this.current = 100;
- }
-
- ((Component)this).repaint();
- }
-
- public int getCurrentAmount() {
- return this.current;
- }
-
- public int getTotalAmount() {
- return this.total;
- }
-
- public Dimension getPreferredSize() {
- return new Dimension(this.Width, this.Height);
- }
-
- public Dimension getMinimumSize() {
- return new Dimension(this.Width, this.Height);
- }
- }
-