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

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.Rectangle;
  4. import javax.swing.ListSelectionModel;
  5.  
  6. class BasicListUI$PageDownAction extends BasicListUI.IncrementLeadSelectionAction {
  7.    // $FF: synthetic field
  8.    private final BasicListUI this$0;
  9.  
  10.    protected BasicListUI$PageDownAction(BasicListUI var1, String var2, int var3) {
  11.       super(var1, var2, var3);
  12.       this.this$0 = var1;
  13.    }
  14.  
  15.    protected void ensureIndexIsVisible(int var1) {
  16.       Rectangle var2 = this.this$0.list.getVisibleRect();
  17.       Rectangle var3 = this.this$0.list.getCellBounds(var1, var1);
  18.       var3.y = Math.max(0, var3.y + var3.height - var2.height);
  19.       var3.height = var2.height;
  20.       this.this$0.list.scrollRectToVisible(var3);
  21.    }
  22.  
  23.    protected int getNextIndex() {
  24.       int var1 = this.this$0.list.getLastVisibleIndex();
  25.       ListSelectionModel var2 = this.this$0.list.getSelectionModel();
  26.       if (var1 == -1) {
  27.          var1 = this.this$0.list.getModel().getSize() - 1;
  28.       }
  29.  
  30.       if (var2.getLeadSelectionIndex() == var1) {
  31.          Rectangle var3 = this.this$0.list.getVisibleRect();
  32.          var3.y += var3.height + var3.height - 1;
  33.          var1 = this.this$0.list.locationToIndex(var3.getLocation());
  34.          if (var1 == -1) {
  35.             var1 = this.this$0.list.getModel().getSize() - 1;
  36.          }
  37.       }
  38.  
  39.       return var1;
  40.    }
  41. }
  42.