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

  1. import java.awt.Button;
  2. import java.awt.Component;
  3. import java.awt.Container;
  4. import java.awt.Dimension;
  5. import java.awt.Event;
  6. import java.awt.Font;
  7. import java.awt.LayoutManager;
  8. import java.awt.Panel;
  9.  
  10. public class insertToPageButtons extends Panel {
  11.    private Font normfont = new Font("Helvetica", 0, 11);
  12.    private Dimension panelSize;
  13.    private insertToPage parent;
  14.    Button b_ok;
  15.    Button b_cancel;
  16.    Button b_insert;
  17.  
  18.    private void addButtons() {
  19.       this.b_ok = new Button("OK");
  20.       this.b_ok.setFont(this.normfont);
  21.       this.b_cancel = new Button("Cancel");
  22.       this.b_cancel.setFont(this.normfont);
  23.       this.b_insert = new Button("Insert");
  24.       this.b_insert.setFont(this.normfont);
  25.       ((Container)this).add(this.b_ok);
  26.       ((Container)this).add(this.b_cancel);
  27.       ((Container)this).add(this.b_insert);
  28.    }
  29.  
  30.    private void positionButtons() {
  31.       this.b_ok.reshape(this.panelSize.width - 105, 7, 50, 20);
  32.       this.b_cancel.reshape(this.panelSize.width - 55, 7, 50, 20);
  33.       this.b_insert.reshape(5, 7, 60, 20);
  34.    }
  35.  
  36.    insertToPageButtons(insertToPage var1) {
  37.       this.parent = var1;
  38.       ((Container)this).setLayout((LayoutManager)null);
  39.       ((Component)this).setBackground(ACutilb.windowColor);
  40.       this.addButtons();
  41.    }
  42.  
  43.    public void resize(Dimension var1) {
  44.       this.panelSize = var1;
  45.       this.positionButtons();
  46.       super.resize(var1);
  47.    }
  48.  
  49.    public void resize(int var1, int var2) {
  50.       this.panelSize = new Dimension(var1, var2);
  51.       this.positionButtons();
  52.       super.resize(var1, var2);
  53.    }
  54.  
  55.    public boolean handleEvent(Event var1) {
  56.       if (var1.id == 1001) {
  57.          if (var1.target == this.b_ok) {
  58.             this.parent.saveCurrent();
  59.             this.parent.killWindow();
  60.          } else if (var1.target == this.b_cancel) {
  61.             this.parent.killWindow();
  62.          } else if (var1.target == this.b_insert) {
  63.             this.parent.insert();
  64.          }
  65.       }
  66.  
  67.       return true;
  68.    }
  69.  
  70.    public void reshape(int var1, int var2, int var3, int var4) {
  71.       this.panelSize = new Dimension(var3, var4);
  72.       this.positionButtons();
  73.       super.reshape(var1, var2, var3, var4);
  74.    }
  75. }
  76.