Changeset 11565 for trunk/gsdl
- Timestamp:
- 2006-04-03T10:01:06+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/java/org/nzdl/gsdl/GsdlCollageApplet/GsdlCollageApplet.java
r11471 r11565 1 1 package org.nzdl.gsdl.GsdlCollageApplet; 2 2 3 import java.applet. *;3 import java.applet.Applet; 4 4 import java.awt.*; 5 5 import java.net.*; … … 67 67 protected DisplayImages display_thread_ = null; 68 68 69 protected Display display_ = null;69 70 70 71 71 /** Gets verbosity */ … … 92 92 * the gwcgi, collection and classifier parameters as provided. 93 93 * Then starts downloading and displaying images */ 94 95 Thread paint ; 96 94 97 public void init() 95 98 { … … 123 126 System.err.println("Got parameters."); 124 127 } 125 128 verbosity_=0; 126 129 if (caption_param != null && !caption_param.startsWith("_")) { 127 130 caption_ = caption_param; … … 176 179 if ((max_downloads_param!=null) && (!max_downloads_param.startsWith("_"))) { 177 180 maxDownloads_ = Integer.parseInt(max_downloads_param); 181 System.out.println(" maxDownloads " + maxDownloads_ ); 182 maxDownloads_=50; 178 183 } 179 184 180 185 if ((max_display_param!=null) && (!max_display_param.startsWith("_"))) { 181 186 maxDisplay_ = Integer.parseInt(max_display_param); 187 182 188 } 183 189 … … 217 223 } 218 224 225 MediaTracker trk = new MediaTracker(this); 219 226 220 227 // creates a class to store the image and it's associated url 221 download_images_ = new DownloadImages( verbosity_);228 download_images_ = new DownloadImages( this, verbosity_,isJava2_ ); 222 229 // starts the download image thread with the starting url 223 230 224 231 download_thread_ = new DownloadUrls(this, download_images_, 225 232 image_url, href_musthave, image_mustnothave, 226 image_ignore, imageType_,document_root,verbosity_ );233 image_ignore, imageType_,document_root,verbosity_,trk); 227 234 // starts the display image thread with the currently downloaded images 228 display_thread_ = new DisplayImages(this,download_images_, isJava2_, bgcolor_); 229 display_ = new Display(this); 230 } 235 display_thread_ = new DisplayImages(this, download_images_,isJava2_, bgcolor_); 236 237 } 238 239 231 240 232 241 /** Goes to the url associated with the image that is clicked on screen<br> … … 256 265 public void start() 257 266 { 258 download_thread_.start(); 267 268 paint = new Thread(new Runnable(){ 269 public void run() { 270 try { 271 272 Thread curr_thread = Thread.currentThread(); 273 274 while (curr_thread == paint) { 275 276 repaint(); 277 278 Thread.sleep(1000); 279 curr_thread = Thread.currentThread(); 280 } 281 282 283 } catch (Exception e) { 284 e.printStackTrace(); 285 } 286 } 287 288 289 }); 290 291 paint.start(); 292 293 294 download_thread_.start(); 295 259 296 display_thread_.start(); 260 display_.start(); 297 261 298 } 262 299 … … 266 303 download_thread_.stop(); 267 304 display_thread_.stop(); 268 display_.stop(); 269 305 270 306 download_thread_ = null; 271 307 display_thread_ = null; 272 display_ = null;308 273 309 } 274 310 … … 277 313 { 278 314 download_thread_ = null; 315 279 316 display_thread_ = null; 280 display_ = null; 281 } 317 318 } 319 282 320 283 321 /** Repaints the applet */ … … 287 325 paint(g); 288 326 } 289 327 290 328 /** Repaints the applet using the paint method of the thread that is 291 329 * currently displaying images */ 292 330 public void paint(Graphics g) { 293 331 if (display_thread_!=null) 294 { 295 //display_thread_.display_collage(); 296 display_thread_.paint(g); 297 } 332 { 333 334 //display_thread_.display_collage(); 335 display_thread_.paint(g); 336 } 298 337 else 299 { 300 System.err.println("Applet still trying to paint!!"); 301 } 302 } 303 304 338 { 339 System.err.println("Applet still trying to paint!!"); 340 } 341 342 343 344 } 345 346 305 347 306 348 /** Ensures a URL address (as string) has a protocol, host, and file.
Note:
See TracChangeset
for help on using the changeset viewer.