home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 144 / DPCS0200.iso / Internet / Supanet / system / swing.jar / javax / swing / plaf / basic / BasicTreeUI$TreeAddSelectionAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-05  |  1.5 KB  |  48 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.event.ActionEvent;
  4. import javax.swing.AbstractAction;
  5. import javax.swing.tree.TreePath;
  6.  
  7. class BasicTreeUI$TreeAddSelectionAction extends AbstractAction {
  8.    // $FF: synthetic field
  9.    private final BasicTreeUI this$0;
  10.    private boolean changeAnchor;
  11.  
  12.    public BasicTreeUI$TreeAddSelectionAction(BasicTreeUI var1, String var2, boolean var3) {
  13.       super(var2);
  14.       this.this$0 = var1;
  15.       this.changeAnchor = var3;
  16.    }
  17.  
  18.    public void actionPerformed(ActionEvent var1) {
  19.       int var2 = this.this$0.getRowCount(this.this$0.tree);
  20.       if (this.this$0.tree != null && var2 > 0) {
  21.          int var3 = BasicTreeUI.access$5(this.this$0);
  22.          TreePath var4 = BasicTreeUI.access$9(this.this$0);
  23.          TreePath var5 = BasicTreeUI.access$4(this.this$0);
  24.          if (var3 == -1) {
  25.             var3 = 0;
  26.          }
  27.  
  28.          if (!this.changeAnchor) {
  29.             if (this.this$0.tree.isRowSelected(var3)) {
  30.                this.this$0.tree.removeSelectionRow(var3);
  31.                BasicTreeUI.access$3(this.this$0, var5);
  32.             } else {
  33.                this.this$0.tree.addSelectionRow(var3);
  34.             }
  35.  
  36.             BasicTreeUI.access$2(this.this$0, var4);
  37.          } else {
  38.             this.this$0.tree.setSelectionRow(var3);
  39.          }
  40.       }
  41.  
  42.    }
  43.  
  44.    public boolean isEnabled() {
  45.       return this.this$0.tree != null && this.this$0.tree.isEnabled();
  46.    }
  47. }
  48.