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 / BasicSliderUI$ActionScroller.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-26  |  1.7 KB  |  68 lines

  1. package com.sun.java.swing.plaf.basic;
  2.  
  3. import com.sun.java.swing.AbstractAction;
  4. import com.sun.java.swing.JSlider;
  5. import java.awt.event.ActionEvent;
  6. import java.io.Serializable;
  7.  
  8. class BasicSliderUI$ActionScroller extends AbstractAction implements Serializable {
  9.    // $FF: synthetic field
  10.    private final BasicSliderUI this$0;
  11.    int dir;
  12.    boolean block;
  13.    JSlider slider;
  14.  
  15.    public BasicSliderUI$ActionScroller(BasicSliderUI var1, JSlider var2, int var3, boolean var4) {
  16.       this.this$0 = var1;
  17.       this.this$0 = var1;
  18.       this.dir = var3;
  19.       this.block = var4;
  20.       this.slider = var2;
  21.    }
  22.  
  23.    public void actionPerformed(ActionEvent var1) {
  24.       if (this.slider.isEnabled()) {
  25.          if (this.dir == -1 || this.dir == 1) {
  26.             int var2 = this.dir;
  27.             if (this.slider.getInverted()) {
  28.                var2 = this.dir == -1 ? 1 : -1;
  29.             }
  30.  
  31.             if (this.block) {
  32.                this.this$0.scrollByBlock(var2);
  33.                return;
  34.             }
  35.  
  36.             this.this$0.scrollByUnit(var2);
  37.             return;
  38.          }
  39.  
  40.          if (this.slider.getInverted()) {
  41.             if (this.dir == -2) {
  42.                this.slider.setValue(this.slider.getMaximum());
  43.                return;
  44.             }
  45.  
  46.             if (this.dir == 2) {
  47.                this.slider.setValue(this.slider.getMinimum());
  48.                return;
  49.             }
  50.          } else {
  51.             if (this.dir == -2) {
  52.                this.slider.setValue(this.slider.getMinimum());
  53.                return;
  54.             }
  55.  
  56.             if (this.dir == 2) {
  57.                this.slider.setValue(this.slider.getMaximum());
  58.             }
  59.          }
  60.       }
  61.  
  62.    }
  63.  
  64.    public boolean isEnabled() {
  65.       return true;
  66.    }
  67. }
  68.