home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161a.iso / handson / files / copyjava.exe / com / sun / java / swing / plaf / basic / BasicTreeUI$TreeIncrementAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-26  |  1.9 KB  |  44 lines

  1. package com.sun.java.swing.plaf.basic;
  2.  
  3. import com.sun.java.swing.AbstractAction;
  4. import java.awt.event.ActionEvent;
  5. import java.io.Serializable;
  6.  
  7. class BasicTreeUI$TreeIncrementAction extends AbstractAction implements Serializable {
  8.    // $FF: synthetic field
  9.    private final BasicTreeUI this$0;
  10.    private int direction;
  11.  
  12.    public BasicTreeUI$TreeIncrementAction(BasicTreeUI var1, int var2, String var3) {
  13.       super(var3);
  14.       this.this$0 = var1;
  15.       this.this$0 = var1;
  16.       this.direction = var2;
  17.    }
  18.  
  19.    public void actionPerformed(ActionEvent var1) {
  20.       int var2;
  21.       if (this.this$0.tree != null && this.this$0.treeSelectionModel != null && (var2 = this.this$0.getRowCount()) > 0) {
  22.          int var3 = this.this$0.tree.getMaxSelectionRow();
  23.          int var4;
  24.          if (var3 == -1) {
  25.             if (this.direction == 1) {
  26.                var4 = 0;
  27.             } else {
  28.                var4 = var2 - 1;
  29.             }
  30.          } else {
  31.             var4 = Math.min(var2 - 1, Math.max(0, var3 + this.direction));
  32.          }
  33.  
  34.          this.this$0.tree.setSelectionInterval(var4, var4);
  35.          this.this$0.ensureRowsAreVisible(var4, var4);
  36.       }
  37.  
  38.    }
  39.  
  40.    public boolean isEnabled() {
  41.       return this.this$0.tree != null && this.this$0.tree.isEnabled();
  42.    }
  43. }
  44.