1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/* */ package NET.worlds.network;
/* */
/* */ import NET.worlds.console.Console;
/* */ import java.awt.Canvas;
/* */ import java.awt.Color;
/* */ import java.awt.Dimension;
/* */ import java.awt.Event;
/* */ import java.awt.Font;
/* */ import java.awt.FontMetrics;
/* */ import java.awt.Graphics;
/* */ import java.awt.Toolkit;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class ProgressBar
/* */ extends Canvas
/* */ {
/* */ private static final long serialVersionUID = -4391762871660491011L;
/* */ private static final int borderThickness = 1;
/* */ private static final int heightPadding = 2;
/* */ private int barWidth;
/* */ private int barHeight;
/* */ private Font font;
/* 37 */ private int fillWidth = -1;
/* */
/* */ private int percent;
/* */
/* */ public ProgressBar(int width)
/* */ {
/* 43 */ this.barWidth = width;
/* 44 */ this.font = new Font(Console.message("DialogFont"), 1, 14);
/* */
/* 46 */ FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(this.font);
/* 47 */ this.barHeight = (fm.getAscent() + 4 + 2);
/* */ }
/* */
/* */ public void setProgress(double amt)
/* */ {
/* 52 */ int visibleWidth = getSize().width;
/* 53 */ if (visibleWidth == 0)
/* 54 */ visibleWidth = this.barWidth;
/* 55 */ int width = (int)(amt * (visibleWidth - 2));
/* 56 */ if (width != this.fillWidth) {
/* 57 */ this.fillWidth = width;
/* 58 */ this.percent = ((int)Math.round(100.0D * amt));
/* 59 */ repaint();
/* */ }
/* */ }
/* */
/* */ public Dimension getPreferredSize()
/* */ {
/* 65 */ return new Dimension(this.barWidth, this.barHeight);
/* */ }
/* */
/* */ public Dimension getMinimumSize()
/* */ {
/* 70 */ return getPreferredSize();
/* */ }
/* */
/* */ @Deprecated
/* */ public boolean handleEvent(Event event)
/* */ {
/* 76 */ if (event.id == 201)
/* 77 */ return true;
/* 78 */ return super.handleEvent(event);
/* */ }
/* */
/* */ public void paint(Graphics g)
/* */ {
/* 83 */ Dimension size = getSize();
/* 84 */ int width = size.width;
/* 85 */ int height = size.height;
/* 86 */ g.setColor(Color.lightGray);
/* 87 */ g.draw3DRect(0, 0, width - 1, height - 1, true);
/* 88 */ if (this.fillWidth > 0) {
/* 89 */ g.setColor(Color.blue);
/* 90 */ g.fillRect(1, 1, this.fillWidth, height -
/* 91 */ 2);
/* */ }
/* 93 */ String text = this.percent + "%";
/* 94 */ g.setFont(this.font);
/* 95 */ FontMetrics fm = g.getFontMetrics();
/* 96 */ int textWidth = fm.stringWidth(text);
/* 97 */ g.setColor(Color.black);
/* 98 */ g.drawString(text, (width - textWidth) / 2,
/* 99 */ (height + fm.getAscent()) / 2 - 1);
/* */ }
/* */ }
/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\network\ProgressBar.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|