home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2002 June / INTERNET92.ISO / pc / software / windows / building / visual_dhtml / visualdhtmlwin9x_nt.exe / OCwin.___ (.txt) < prev    next >
Encoding:
Java Class File  |  2001-10-19  |  2.2 KB  |  125 lines

  1. import java.awt.Color;
  2. import java.awt.Component;
  3. import java.awt.Dimension;
  4. import java.awt.Event;
  5. import java.awt.Frame;
  6. import java.awt.Graphics;
  7. import java.awt.Image;
  8. import java.awt.Rectangle;
  9. import java.awt.Window;
  10.  
  11. class OCwin extends Window {
  12.    boolean paintCalled;
  13.    Image off;
  14.    Graphics g_off;
  15.    int barHeight = 20;
  16.    // $FF: renamed from: d java.awt.Dimension
  17.    Dimension field_0;
  18.    int oldx;
  19.    int oldy;
  20.    int iposx;
  21.    int iposy;
  22.    long timestamp;
  23.    long WAIT_TIME = 5L;
  24.    Rectangle bar;
  25.    boolean mouse_in = false;
  26.    boolean inBar = false;
  27.  
  28.    public void reshape(int var1, int var2, int var3, int var4) {
  29.       this.field_0 = new Dimension(var3, var4);
  30.       if (this.paintCalled) {
  31.          this.paintCalled = false;
  32.          this.paintIt();
  33.       }
  34.  
  35.       super.reshape(var1, var2, var3, var4);
  36.    }
  37.  
  38.    public boolean mouseEnter(Event var1, int var2, int var3) {
  39.       this.mouse_in = true;
  40.       return true;
  41.    }
  42.  
  43.    public void initialize() {
  44.       this.bar = new Rectangle(0, 0, this.field_0.width, this.barHeight);
  45.       this.off = ((Component)this).createImage(this.field_0.width, this.barHeight);
  46.       this.g_off = this.off.getGraphics();
  47.       this.g_off.setColor(Color.black);
  48.       this.g_off.fillRect(0, 0, this.field_0.width, this.barHeight);
  49.    }
  50.  
  51.    public boolean mouseExit(Event var1, int var2, int var3) {
  52.       this.mouse_in = false;
  53.       return true;
  54.    }
  55.  
  56.    OCwin(Frame var1) {
  57.       super(var1);
  58.    }
  59.  
  60.    public void paint(Graphics var1) {
  61.       this.paintIt();
  62.    }
  63.  
  64.    public boolean mouseUp(Event var1, int var2, int var3) {
  65.       return true;
  66.    }
  67.  
  68.    public void moveIt(int var1, int var2) {
  69.       ((Component)this).move(this.oldx + var1 - this.iposx, this.oldy + var2 - this.iposy);
  70.       this.oldx += var1 - this.iposx;
  71.       this.oldy += var2 - this.iposy;
  72.    }
  73.  
  74.    public synchronized void paintIt() {
  75.       Graphics var1 = ((Component)this).getGraphics();
  76.       if (!this.paintCalled) {
  77.          this.initialize();
  78.          this.paintCalled = true;
  79.       }
  80.  
  81.       var1.drawImage(this.off, 0, 0, this);
  82.    }
  83.  
  84.    public void resize(Dimension var1) {
  85.       if (this.paintCalled) {
  86.          this.paintCalled = false;
  87.          this.paintIt();
  88.       }
  89.  
  90.       super.resize(var1);
  91.    }
  92.  
  93.    public void resize(int var1, int var2) {
  94.       this.field_0 = new Dimension(var1, var2);
  95.       if (this.paintCalled) {
  96.          this.paintCalled = false;
  97.          this.paintIt();
  98.       }
  99.  
  100.       super.resize(var1, var2);
  101.    }
  102.  
  103.    public boolean mouseDown(Event var1, int var2, int var3) {
  104.       if (var3 < this.barHeight) {
  105.          this.inBar = true;
  106.       }
  107.  
  108.       ((Component)this).requestFocus();
  109.       return true;
  110.    }
  111.  
  112.    public boolean mouseDrag(Event var1, int var2, int var3) {
  113.       if (var1.when > this.timestamp + this.WAIT_TIME && this.inBar) {
  114.          this.moveIt(var2, var3);
  115.          this.timestamp = var1.when;
  116.       }
  117.  
  118.       return true;
  119.    }
  120.  
  121.    public boolean mouseMove(Event var1, int var2, int var3) {
  122.       return true;
  123.    }
  124. }
  125.