home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / plaf / basic / BasicToolBarUI$DragWindow.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.0 KB  |  84 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Dimension;
  6. import java.awt.Frame;
  7. import java.awt.Graphics;
  8. import java.awt.Insets;
  9. import java.awt.Point;
  10. import java.awt.Window;
  11.  
  12. public class BasicToolBarUI$DragWindow extends Window {
  13.    Color borderColor;
  14.    int orientation;
  15.    Point offset;
  16.    // $FF: synthetic field
  17.    private final BasicToolBarUI this$0;
  18.  
  19.    BasicToolBarUI$DragWindow(BasicToolBarUI var1, Frame var2) {
  20.       super(var2);
  21.       this.this$0 = var1;
  22.       this.borderColor = Color.gray;
  23.       this.orientation = this.this$0.toolBar.getOrientation();
  24.    }
  25.  
  26.    public void setOrientation(int var1) {
  27.       if (((Window)this).isShowing()) {
  28.          if (var1 == this.orientation) {
  29.             return;
  30.          }
  31.  
  32.          this.orientation = var1;
  33.          Dimension var2 = ((Component)this).getSize();
  34.          ((Component)this).setSize(new Dimension(var2.height, var2.width));
  35.          if (this.offset != null) {
  36.             if (BasicGraphicsUtils.isLeftToRight(this.this$0.toolBar)) {
  37.                this.setOffset(new Point(this.offset.y, this.offset.x));
  38.             } else if (var1 == 0) {
  39.                this.setOffset(new Point(var2.height - this.offset.y, this.offset.x));
  40.             } else {
  41.                this.setOffset(new Point(this.offset.y, var2.width - this.offset.x));
  42.             }
  43.          }
  44.  
  45.          ((Component)this).repaint();
  46.       }
  47.  
  48.    }
  49.  
  50.    public Point getOffset() {
  51.       return this.offset;
  52.    }
  53.  
  54.    public void setOffset(Point var1) {
  55.       this.offset = var1;
  56.    }
  57.  
  58.    public void setBorderColor(Color var1) {
  59.       if (this.borderColor != var1) {
  60.          this.borderColor = var1;
  61.          ((Component)this).repaint();
  62.       }
  63.    }
  64.  
  65.    public Color getBorderColor() {
  66.       return this.borderColor;
  67.    }
  68.  
  69.    public void paint(Graphics var1) {
  70.       Color var2 = var1.getColor();
  71.       var1.setColor(((Component)this).getBackground());
  72.       Dimension var3 = ((Component)this).getSize();
  73.       var1.fillRect(0, 0, var3.width, var3.height);
  74.       var1.setColor(this.getBorderColor());
  75.       var1.drawRect(0, 0, var3.width - 1, var3.height - 1);
  76.       var1.setColor(var2);
  77.       super.paint(var1);
  78.    }
  79.  
  80.    public Insets getInsets() {
  81.       return new Insets(1, 1, 1, 1);
  82.    }
  83. }
  84.