155 |
*/ |
*/ |
156 |
public boolean grabPixels() throws InterruptedException |
public boolean grabPixels() throws InterruptedException |
157 |
{ |
{ |
158 |
startGrabbing(); |
return grabPixels(0); |
|
while ( (status != ImageObserver.ALLBITS ) || |
|
|
(status != ImageObserver.ERROR ) || |
|
|
(status != ImageObserver.ABORT ) ); |
|
|
|
|
|
if( status == ImageObserver.ALLBITS ) |
|
|
return true; |
|
|
else |
|
|
return false; |
|
159 |
} |
} |
160 |
|
|
161 |
/** |
/** |
168 |
*/ |
*/ |
169 |
public synchronized boolean grabPixels(long ms) throws InterruptedException |
public synchronized boolean grabPixels(long ms) throws InterruptedException |
170 |
{ |
{ |
|
long start = System.currentTimeMillis(); |
|
171 |
startGrabbing(); |
startGrabbing(); |
172 |
while ( (status != ImageObserver.ALLBITS ) || |
|
173 |
(status != ImageObserver.ERROR ) || |
if (ms < 0) |
174 |
(status != ImageObserver.ABORT ) ) |
return (status == ImageObserver.ALLBITS); |
175 |
{ |
|
176 |
if( (System.currentTimeMillis() - start ) >= ms ) |
wait(ms); |
177 |
{ |
|
178 |
abortGrabbing(); |
if (status == ImageObserver.ALLBITS) |
|
throw new InterruptedException(); |
|
|
} |
|
|
} |
|
|
|
|
|
if( status == ImageObserver.ALLBITS ) |
|
179 |
return true; |
return true; |
180 |
else |
else |
181 |
return false; |
return false; |
|
|
|
182 |
} |
} |
183 |
|
|
184 |
/** |
/** |