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$TreeScrollLRAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.8 KB  |  50 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.Rectangle;
  4. import java.awt.event.ActionEvent;
  5. import javax.swing.AbstractAction;
  6. import javax.swing.tree.TreePath;
  7.  
  8. class BasicTreeUI$TreeScrollLRAction extends AbstractAction {
  9.    protected int direction;
  10.    private boolean addToSelection;
  11.    private boolean changeSelection;
  12.    // $FF: synthetic field
  13.    private final BasicTreeUI this$0;
  14.  
  15.    BasicTreeUI$TreeScrollLRAction(BasicTreeUI var1, int var2, String var3, boolean var4, boolean var5) {
  16.       this.this$0 = var1;
  17.       this.direction = var2;
  18.       this.addToSelection = var4;
  19.       this.changeSelection = var5;
  20.    }
  21.  
  22.    public void actionPerformed(ActionEvent var1) {
  23.       if (this.this$0.tree != null && this.this$0.getRowCount(this.this$0.tree) > 0 && this.this$0.treeSelectionModel != null) {
  24.          Rectangle var4 = this.this$0.tree.getVisibleRect();
  25.          TreePath var3;
  26.          if (this.direction == -1) {
  27.             var3 = this.this$0.getClosestPathForLocation(this.this$0.tree, var4.x, var4.y);
  28.             var4.x = Math.max(0, var4.x - var4.width);
  29.          } else {
  30.             var4.x = Math.min(Math.max(0, this.this$0.tree.getWidth() - var4.width), var4.x + var4.width);
  31.             var3 = this.this$0.getClosestPathForLocation(this.this$0.tree, var4.x, var4.y + var4.height);
  32.          }
  33.  
  34.          this.this$0.tree.scrollRectToVisible(var4);
  35.          if (this.addToSelection) {
  36.             BasicTreeUI.access$1500(this.this$0, var3);
  37.          } else if (this.changeSelection) {
  38.             this.this$0.tree.setSelectionPath(var3);
  39.          } else {
  40.             BasicTreeUI.access$1400(this.this$0, var3, true);
  41.          }
  42.       }
  43.  
  44.    }
  45.  
  46.    public boolean isEnabled() {
  47.       return this.this$0.tree != null && this.this$0.tree.isEnabled();
  48.    }
  49. }
  50.