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$TreeHomeAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-26  |  1.7 KB  |  38 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$TreeHomeAction extends AbstractAction implements Serializable {
  8.    // $FF: synthetic field
  9.    private final BasicTreeUI this$0;
  10.    private int direction;
  11.  
  12.    public BasicTreeUI$TreeHomeAction(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 = this.this$0.getRowCount();
  21.       if (this.this$0.tree != null && var2 > 0) {
  22.          if (this.direction == -1) {
  23.             this.this$0.ensureRowsAreVisible(0, 0);
  24.             this.this$0.tree.setSelectionInterval(0, 0);
  25.             return;
  26.          }
  27.  
  28.          this.this$0.ensureRowsAreVisible(var2 - 1, var2 - 1);
  29.          this.this$0.tree.setSelectionInterval(var2 - 1, var2 - 1);
  30.       }
  31.  
  32.    }
  33.  
  34.    public boolean isEnabled() {
  35.       return this.this$0.tree != null && this.this$0.tree.isEnabled();
  36.    }
  37. }
  38.