Changeset 4016


Ignore:
Timestamp:
05/07/08 13:47:51 (12 years ago)
Author:
curtis
Message:

Fix up animation thread.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/plugins/CustomWindow.java

    r3822 r4016  
    6262  protected JSpinner cSpin; 
    6363  protected Button animate, options, metadata; 
    64   protected boolean anim = false, die = false; 
     64  protected boolean anim = false; 
    6565  protected boolean allowShow = false; 
    6666 
     
    176176    add(controls, BorderLayout.SOUTH); 
    177177 
     178    FileInfo fi = imp.getOriginalFileInfo(); 
     179    if (fi.description != null && fi.description.startsWith("<?xml")) { 
     180      setXML(fi.description); 
     181    } 
     182 
     183    allowShow = true; 
     184    pack(); 
     185    setVisible(true); 
     186 
    178187    // start up animation thread 
    179188    if (frameSelector != null) { 
    180       new Thread() { 
     189      // NB: Cannot implement Runnable because one of the superclasses does so 
     190      // for its SliceSelector thread, and overriding results in a conflict. 
     191      new Thread("DataBrowser-Animation") { 
    181192        public void run() { 
    182           while (!die) { 
     193          while (isVisible()) { 
    183194            int ms = 200; 
    184195            if (anim) { 
     
    200211      }.start(); 
    201212    } 
    202  
    203     FileInfo fi = imp.getOriginalFileInfo(); 
    204     if (fi.description != null && fi.description.startsWith("<?xml")) { 
    205       setXML(fi.description); 
    206     } 
    207  
    208     allowShow = true; 
    209     pack(); 
    210     setVisible(true); 
    211213  } 
    212214 
     
    268270 
    269271  public void dispose() { 
    270     die = true; // terminate animation thread 
    271272    super.dispose(); 
    272273  } 
Note: See TracChangeset for help on using the changeset viewer.