home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / plaf / basic / BasicTreeUI$ComponentHandler.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.5 KB  |  72 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Container;
  5. import java.awt.event.ActionEvent;
  6. import java.awt.event.ActionListener;
  7. import java.awt.event.ComponentAdapter;
  8. import java.awt.event.ComponentEvent;
  9. import javax.swing.JScrollBar;
  10. import javax.swing.JScrollPane;
  11. import javax.swing.Timer;
  12.  
  13. public class BasicTreeUI$ComponentHandler extends ComponentAdapter implements ActionListener {
  14.    protected Timer timer;
  15.    protected JScrollBar scrollBar;
  16.    // $FF: synthetic field
  17.    private final BasicTreeUI this$0;
  18.  
  19.    public BasicTreeUI$ComponentHandler(BasicTreeUI var1) {
  20.       this.this$0 = var1;
  21.    }
  22.  
  23.    public void componentMoved(ComponentEvent var1) {
  24.       if (this.timer == null) {
  25.          JScrollPane var2 = this.getScrollPane();
  26.          if (var2 == null) {
  27.             this.this$0.updateSize();
  28.          } else {
  29.             this.scrollBar = var2.getVerticalScrollBar();
  30.             if (this.scrollBar != null && this.scrollBar.getValueIsAdjusting()) {
  31.                this.startTimer();
  32.             } else if ((this.scrollBar = var2.getHorizontalScrollBar()) != null && this.scrollBar.getValueIsAdjusting()) {
  33.                this.startTimer();
  34.             } else {
  35.                this.this$0.updateSize();
  36.             }
  37.          }
  38.       }
  39.  
  40.    }
  41.  
  42.    protected void startTimer() {
  43.       if (this.timer == null) {
  44.          this.timer = new Timer(200, this);
  45.          this.timer.setRepeats(true);
  46.       }
  47.  
  48.       this.timer.start();
  49.    }
  50.  
  51.    protected JScrollPane getScrollPane() {
  52.       Container var1;
  53.       for(var1 = this.this$0.tree.getParent(); var1 != null && !(var1 instanceof JScrollPane); var1 = ((Component)var1).getParent()) {
  54.       }
  55.  
  56.       return var1 instanceof JScrollPane ? (JScrollPane)var1 : null;
  57.    }
  58.  
  59.    public void actionPerformed(ActionEvent var1) {
  60.       if (this.scrollBar == null || !this.scrollBar.getValueIsAdjusting()) {
  61.          if (this.timer != null) {
  62.             this.timer.stop();
  63.          }
  64.  
  65.          this.this$0.updateSize();
  66.          this.timer = null;
  67.          this.scrollBar = null;
  68.       }
  69.  
  70.    }
  71. }
  72.