home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 November / PCO1197.ISO / FilesBBS / WIN95 / NET_COM / N32E403.EXE / nav40l.z / java40.jar / java / awt / Frame.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-09-04  |  3.1 KB  |  168 lines

  1. package java.awt;
  2.  
  3. import java.awt.peer.FramePeer;
  4.  
  5. public class Frame extends Window implements MenuContainer {
  6.    public static final int DEFAULT_CURSOR = 0;
  7.    public static final int CROSSHAIR_CURSOR = 1;
  8.    public static final int TEXT_CURSOR = 2;
  9.    public static final int WAIT_CURSOR = 3;
  10.    public static final int SW_RESIZE_CURSOR = 4;
  11.    public static final int SE_RESIZE_CURSOR = 5;
  12.    public static final int NW_RESIZE_CURSOR = 6;
  13.    public static final int NE_RESIZE_CURSOR = 7;
  14.    public static final int N_RESIZE_CURSOR = 8;
  15.    public static final int S_RESIZE_CURSOR = 9;
  16.    public static final int W_RESIZE_CURSOR = 10;
  17.    public static final int E_RESIZE_CURSOR = 11;
  18.    public static final int HAND_CURSOR = 12;
  19.    public static final int MOVE_CURSOR = 13;
  20.    String title;
  21.    Image icon;
  22.    MenuBar menuBar;
  23.    boolean resizable;
  24.    Image cursorImage;
  25.    int cursorType;
  26.    Color cursorFg;
  27.    Color cursorBg;
  28.  
  29.    public Frame() {
  30.       this.title = "Untitled";
  31.       this.resizable = true;
  32.       this.cursorType = 0;
  33.       super.visible = false;
  34.       ((Container)this).setLayout(new BorderLayout());
  35.    }
  36.  
  37.    public Frame(String var1) {
  38.       this();
  39.       this.title = var1;
  40.    }
  41.  
  42.    public synchronized void addNotify() {
  43.       super.peer = ((Window)this).getToolkit().createFrame(this);
  44.       if (this.menuBar != null) {
  45.          this.menuBar.addNotify();
  46.          ((FramePeer)super.peer).setMenuBar(this.menuBar);
  47.       }
  48.  
  49.       super.addNotify();
  50.    }
  51.  
  52.    public String getTitle() {
  53.       return this.title;
  54.    }
  55.  
  56.    public void setTitle(String var1) {
  57.       this.title = var1;
  58.       FramePeer var2 = (FramePeer)super.peer;
  59.       if (var2 != null) {
  60.          var2.setTitle(var1);
  61.       }
  62.  
  63.    }
  64.  
  65.    public Image getIconImage() {
  66.       return this.icon;
  67.    }
  68.  
  69.    public void setIconImage(Image var1) {
  70.       this.icon = var1;
  71.       FramePeer var2 = (FramePeer)super.peer;
  72.       if (var2 != null) {
  73.          var2.setIconImage(var1);
  74.       }
  75.  
  76.    }
  77.  
  78.    public MenuBar getMenuBar() {
  79.       return this.menuBar;
  80.    }
  81.  
  82.    public synchronized void setMenuBar(MenuBar var1) {
  83.       if (this.menuBar != var1) {
  84.          if (var1.parent != null) {
  85.             var1.parent.remove(var1);
  86.          }
  87.  
  88.          if (this.menuBar != null) {
  89.             this.remove(this.menuBar);
  90.          }
  91.  
  92.          this.menuBar = var1;
  93.          this.menuBar.parent = this;
  94.          FramePeer var2 = (FramePeer)super.peer;
  95.          if (var2 != null) {
  96.             this.menuBar.addNotify();
  97.             var2.setMenuBar(this.menuBar);
  98.          }
  99.  
  100.       }
  101.    }
  102.  
  103.    public synchronized void remove(MenuComponent var1) {
  104.       if (var1 == this.menuBar) {
  105.          FramePeer var2 = (FramePeer)super.peer;
  106.          if (var2 != null) {
  107.             this.menuBar.removeNotify();
  108.             this.menuBar.parent = null;
  109.             var2.setMenuBar((MenuBar)null);
  110.          }
  111.  
  112.          this.menuBar = null;
  113.       }
  114.  
  115.    }
  116.  
  117.    public synchronized void dispose() {
  118.       if (this.menuBar != null) {
  119.          this.remove(this.menuBar);
  120.          this.menuBar = null;
  121.       }
  122.  
  123.       super.dispose();
  124.    }
  125.  
  126.    public boolean isResizable() {
  127.       return this.resizable;
  128.    }
  129.  
  130.    public void setResizable(boolean var1) {
  131.       this.resizable = var1;
  132.       FramePeer var2 = (FramePeer)super.peer;
  133.       if (var2 != null) {
  134.          var2.setResizable(var1);
  135.       }
  136.  
  137.    }
  138.  
  139.    public void setCursor(int var1) {
  140.       if (var1 >= 0 && var1 <= 13) {
  141.          this.cursorType = var1;
  142.          if (super.peer != null) {
  143.             ((FramePeer)super.peer).setCursor(var1);
  144.          }
  145.  
  146.       } else {
  147.          throw new IllegalArgumentException("illegal cursor type");
  148.       }
  149.    }
  150.  
  151.    public int getCursorType() {
  152.       return this.cursorType;
  153.    }
  154.  
  155.    protected String paramString() {
  156.       String var1 = super.paramString();
  157.       if (this.resizable) {
  158.          var1 = var1 + ",resizable";
  159.       }
  160.  
  161.       if (this.title != null) {
  162.          var1 = var1 + ",title=" + this.title;
  163.       }
  164.  
  165.       return var1;
  166.    }
  167. }
  168.