home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 139 / dpcs0999.iso / Web / CFserver / data1.cab / Java / netscape / application / AWTComponentView.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-04-12  |  1.8 KB  |  60 lines

  1. package netscape.application;
  2.  
  3. import java.awt.Component;
  4.  
  5. public class AWTComponentView extends View {
  6.    Component component;
  7.    RootView rootView;
  8.  
  9.    public AWTComponentView() {
  10.       this(0, 0, 0, 0);
  11.    }
  12.  
  13.    public AWTComponentView(Rect var1) {
  14.       this(var1.x, var1.y, var1.width, var1.height);
  15.    }
  16.  
  17.    public AWTComponentView(int var1, int var2, int var3, int var4) {
  18.       super(var1, var2, var3, var4);
  19.    }
  20.  
  21.    void setComponentBounds() {
  22.       Rect var1 = super._superview.convertRectToView((View)null, super.bounds);
  23.       this.component.reshape(var1.x, var1.y, var1.width, var1.height);
  24.    }
  25.  
  26.    void addComponent() {
  27.       if (this.rootView != null) {
  28.          this.rootView.addComponentView(this);
  29.       }
  30.  
  31.    }
  32.  
  33.    void removeComponent() {
  34.       if (this.component != null && this.rootView != null) {
  35.          this.rootView.removeComponentView(this);
  36.       }
  37.  
  38.    }
  39.  
  40.    public void setAWTComponent(Component var1) {
  41.       this.removeComponent();
  42.       this.component = var1;
  43.       this.addComponent();
  44.    }
  45.  
  46.    public Component awtComponent() {
  47.       return this.component;
  48.    }
  49.  
  50.    protected void ancestorWillRemoveFromViewHierarchy(View var1) {
  51.       this.removeComponent();
  52.       this.rootView = null;
  53.    }
  54.  
  55.    protected void ancestorWasAddedToViewHierarchy(View var1) {
  56.       this.rootView = ((View)this).rootView();
  57.       this.addComponent();
  58.    }
  59. }
  60.