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

  1. package com.sun.java.swing.event;
  2.  
  3. import com.sun.java.swing.tree.TreePath;
  4. import java.util.EventObject;
  5.  
  6. public class TreeSelectionEvent extends EventObject implements Cloneable {
  7.    protected TreePath[] paths;
  8.    protected boolean[] areNew;
  9.    protected TreePath oldLeadSelectionPath;
  10.    protected TreePath newLeadSelectionPath;
  11.  
  12.    public TreeSelectionEvent(Object var1, TreePath[] var2, boolean[] var3, TreePath var4, TreePath var5) {
  13.       super(var1);
  14.       this.paths = var2;
  15.       this.areNew = var3;
  16.       this.oldLeadSelectionPath = var4;
  17.       this.newLeadSelectionPath = var5;
  18.    }
  19.  
  20.    public TreeSelectionEvent(Object var1, TreePath var2, boolean var3, TreePath var4, TreePath var5) {
  21.       super(var1);
  22.       this.paths = new TreePath[1];
  23.       this.paths[0] = var2;
  24.       this.areNew = new boolean[1];
  25.       this.areNew[0] = var3;
  26.       this.oldLeadSelectionPath = var4;
  27.       this.newLeadSelectionPath = var5;
  28.    }
  29.  
  30.    public TreePath[] getPaths() {
  31.       int var1 = this.paths.length;
  32.       TreePath[] var2 = new TreePath[var1];
  33.       System.arraycopy(this.paths, 0, var2, 0, var1);
  34.       return var2;
  35.    }
  36.  
  37.    public TreePath getPath() {
  38.       return this.paths[0];
  39.    }
  40.  
  41.    public boolean isAddedPath() {
  42.       return this.areNew[0];
  43.    }
  44.  
  45.    public boolean isAddedPath(TreePath var1) {
  46.       for(int var2 = this.paths.length - 1; var2 >= 0; --var2) {
  47.          if (this.paths[var2].equals(var1)) {
  48.             return this.areNew[var2];
  49.          }
  50.       }
  51.  
  52.       throw new IllegalArgumentException("path is not a path identified by the TreeSelectionEvent");
  53.    }
  54.  
  55.    public TreePath getOldLeadSelectionPath() {
  56.       return this.oldLeadSelectionPath;
  57.    }
  58.  
  59.    public TreePath getNewLeadSelectionPath() {
  60.       return this.newLeadSelectionPath;
  61.    }
  62.  
  63.    public Object cloneWithSource(Object var1) {
  64.       TreeSelectionEvent var2;
  65.       try {
  66.          var2 = (TreeSelectionEvent)this.clone();
  67.       } catch (Exception var3) {
  68.          var2 = null;
  69.       }
  70.  
  71.       if (var2 != null) {
  72.          var2.source = var1;
  73.       }
  74.  
  75.       return var2;
  76.    }
  77. }
  78.