Source code: myComponents/myProgressMonitor.java
1 /* Evolvo - Image Generator
2 * Copyright (C) 2000 Andrew Molloy
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 package myComponents;
20
21 import javax.swing.*;
22 import java.awt.*;
23
24 public class myProgressMonitor
25 {
26 ProgressMonitor pm;
27 int progress;
28
29 public myProgressMonitor(Component parentComponent, Object message, String note, int min, int max)
30 {
31 pm = new ProgressMonitor(parentComponent, message, note, min, max);
32 progress = 0;
33 }
34
35 public void close()
36 {
37 synchronized(pm)
38 {
39 pm.close();
40 }
41 }
42
43 public int getMaximum()
44 {
45 synchronized(pm)
46 {
47 return pm.getMaximum();
48 }
49 }
50
51 public int getMillisToDecideToPopup()
52 {
53 synchronized(pm)
54 {
55 return pm.getMillisToDecideToPopup();
56 }
57 }
58
59 public int getMillisToPopup()
60 {
61 synchronized(pm)
62 {
63 return pm.getMillisToPopup();
64 }
65 }
66
67 public int getMinimum()
68 {
69 synchronized(pm)
70 {
71 return pm.getMinimum();
72 }
73 }
74
75 public String getNote()
76 {
77 synchronized(pm)
78 {
79 return pm.getNote();
80 }
81 }
82
83 public boolean isCanceled()
84 {
85 synchronized(pm)
86 {
87 return pm.isCanceled();
88 }
89 }
90
91 public void setMaximum(int m)
92 {
93 synchronized(pm)
94 {
95 pm.setMaximum(m);
96 }
97 }
98
99 public void setMillisToDecideToPopup(int millisToDecideToPopup)
100 {
101 synchronized(pm)
102 {
103 pm.setMillisToDecideToPopup(millisToDecideToPopup);
104 }
105 }
106
107 public void setMillisToPopup(int millisToPopup)
108 {
109 synchronized(pm)
110 {
111 pm.setMillisToPopup(millisToPopup);
112 }
113 }
114
115 public void setMinimum(int m)
116 {
117 synchronized(pm)
118 {
119 pm.setMinimum(m);
120 }
121 }
122
123 public void setNote(String note)
124 {
125 synchronized(pm)
126 {
127 pm.setNote(note);
128 }
129 }
130
131 public void setProgress(int nv)
132 {
133 synchronized(pm)
134 {
135 progress = nv;
136 pm.setProgress(nv);
137 }
138 }
139
140 public ProgressMonitor getProgressMonitor()
141 {
142 synchronized(pm)
143 {
144 return pm;
145 }
146 }
147
148 public void incrementProgress(int i)
149 {
150 synchronized(pm)
151 {
152 progress += i;
153 pm.setProgress(progress);
154 }
155 }
156 }
157
158