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

  1. import java.awt.Button;
  2. import java.awt.Color;
  3. import java.awt.Component;
  4. import java.awt.Container;
  5. import java.awt.Dimension;
  6. import java.awt.Event;
  7. import java.awt.Font;
  8. import java.awt.Graphics;
  9. import java.awt.Image;
  10. import java.awt.LayoutManager;
  11. import java.awt.List;
  12. import java.awt.Panel;
  13.  
  14. public class ACapplstpan extends Panel {
  15.    List dhtmlList;
  16.    // $FF: renamed from: d java.awt.Dimension
  17.    Dimension field_0 = new Dimension(0, 0);
  18.    private Font normfont = new Font("Helvetica", 0, 11);
  19.    private Image off;
  20.    private Graphics g_off;
  21.    boolean first_paint = true;
  22.    boolean ready_resize = false;
  23.    boolean paint_called;
  24.    boolean first_run;
  25.    Color bgColor;
  26.    int alx;
  27.    int aly;
  28.    int alw;
  29.    int alh;
  30.    int blx;
  31.    int bly;
  32.    int blw;
  33.    int blh;
  34.    // $FF: renamed from: ix int
  35.    int field_1;
  36.    // $FF: renamed from: iy int
  37.    int field_2;
  38.    // $FF: renamed from: iw int
  39.    int field_3;
  40.    // $FF: renamed from: ih int
  41.    int field_4;
  42.    private Button select;
  43.    private Button quit;
  44.    private Button template;
  45.    private Button scroller;
  46.    private Button menu;
  47.    public OCTextArea infoarea;
  48.    ACapplst iface;
  49.  
  50.    public void addButtons() {
  51.       this.select = new Button("New");
  52.       this.select.setFont(this.normfont);
  53.       this.template = new Button("Template");
  54.       this.template.setFont(this.normfont);
  55.       this.quit = new Button("Cancel");
  56.       this.quit.setFont(this.normfont);
  57.       this.figureButtons();
  58.       ((Container)this).add(this.select);
  59.       ((Container)this).add(this.template);
  60.       ((Container)this).add(this.quit);
  61.    }
  62.  
  63.    private void reDoGrid() {
  64.       this.first_run = true;
  65.       this.paintIt();
  66.    }
  67.  
  68.    ACapplstpan(ACapplst var1) {
  69.       this.bgColor = ACutilb.windowColor;
  70.       this.alx = 9;
  71.       this.aly = 9;
  72.       this.alw = 160;
  73.       this.alh = 104;
  74.       this.blx = 116;
  75.       this.bly = 126;
  76.       this.blw = 70;
  77.       this.blh = 20;
  78.       this.field_1 = 183;
  79.       this.field_2 = 10;
  80.       this.field_3 = 152;
  81.       this.field_4 = 102;
  82.       this.iface = var1;
  83.       ((Container)this).setLayout((LayoutManager)null);
  84.       ((Component)this).setBackground(this.bgColor);
  85.    }
  86.  
  87.    public void paint(Graphics var1) {
  88.       this.paint_called = true;
  89.       this.paintIt();
  90.    }
  91.  
  92.    private synchronized void paintIt() {
  93.       if (this.paint_called) {
  94.          Graphics var1 = ((Component)this).getGraphics();
  95.          if (this.first_paint) {
  96.             this.drawArea();
  97.             var1.drawImage(this.off, 0, 0, this);
  98.             this.first_paint = false;
  99.          } else {
  100.             var1.drawImage(this.off, 0, 0, this);
  101.          }
  102.       }
  103.    }
  104.  
  105.    public void figureInfoArea() {
  106.       this.infoarea.reshape(this.field_1, this.field_2, this.field_3, this.field_4);
  107.    }
  108.  
  109.    public void resize(Dimension var1) {
  110.       if (var1.width * var1.height > 0) {
  111.          this.reFigureAll();
  112.          super.resize(var1);
  113.       }
  114.    }
  115.  
  116.    public void resize(int var1, int var2) {
  117.       if (var1 * var2 > 0) {
  118.          this.field_0 = new Dimension(var1, var2);
  119.          this.reFigureAll();
  120.          super.resize(var1, var2);
  121.       }
  122.    }
  123.  
  124.    public void addAppList() {
  125.       this.dhtmlList = new List();
  126.       ((Container)this).add(this.dhtmlList);
  127.    }
  128.  
  129.    public void reFigureAll() {
  130.       if (!this.first_run && this.ready_resize) {
  131.          this.figureInfoArea();
  132.          this.figureButtons();
  133.       }
  134.  
  135.       this.first_run = false;
  136.    }
  137.  
  138.    public void figureButtons() {
  139.       this.select.reshape(this.blx, this.bly, this.blw, this.blh);
  140.       this.template.reshape(this.blx + this.blw + 5, this.bly, this.blw, this.blh);
  141.       this.quit.reshape(this.blx + this.blw * 2 + 10, this.bly, this.blw, this.blh);
  142.    }
  143.  
  144.    public void addComponentSelection() {
  145.       this.dhtmlList = new List();
  146.       this.dhtmlList.reshape(this.alx, this.aly, this.alw, this.alh);
  147.  
  148.       for(int var1 = 0; var1 < this.iface.appListInfo[0].length; ++var1) {
  149.          this.dhtmlList.addItem(this.iface.appListInfo[0][var1]);
  150.       }
  151.  
  152.       this.dhtmlList.select(this.iface.cur_selection);
  153.       ((Container)this).add(this.dhtmlList);
  154.    }
  155.  
  156.    public void addInfoArea() {
  157.       this.infoarea = new OCTextArea(this.iface.appListInfo[1][this.iface.cur_selection]);
  158.       this.infoarea.setFont("Helvetica, plain, 11");
  159.       this.infoarea.setTitleFont("Helvetica, bold, 12");
  160.       this.infoarea.setAlign(1);
  161.       this.infoarea.setVAlign(1);
  162.       this.infoarea.setTopMargin(2);
  163.       this.infoarea.setExtraTitleSpace(0);
  164.       this.infoarea.setUnderlineTitle(true);
  165.       this.figureInfoArea();
  166.       ((Container)this).add(this.infoarea);
  167.    }
  168.  
  169.    public void drawArea() {
  170.       this.off = ((Component)this).createImage(this.field_0.width, this.field_0.height);
  171.       this.g_off = this.off.getGraphics();
  172.       this.g_off.setColor(Color.white);
  173.       this.g_off.drawRect(this.field_1 - 1, this.field_2 - 1, this.field_3 + 2, this.field_4 + 2);
  174.       this.g_off.setColor(Color.gray);
  175.       this.g_off.drawRect(this.field_1 - 2, this.field_2 - 2, this.field_3 + 2, this.field_4 + 2);
  176.       this.g_off.setColor(Color.white);
  177.       this.g_off.drawLine(this.field_1, this.field_2, this.field_1 + this.field_3 - 1, this.field_2);
  178.       this.g_off.drawLine(this.field_1, this.field_2, this.field_1, this.field_2 + this.field_4 - 1);
  179.    }
  180.  
  181.    public Dimension getMinimumSize() {
  182.       return new Dimension(50, 50);
  183.    }
  184.  
  185.    public Dimension getPreferredSize() {
  186.       return new Dimension(50, 50);
  187.    }
  188.  
  189.    public boolean handleEvent(Event var1) {
  190.       if (var1.id == 701) {
  191.          if (var1.target == this.dhtmlList) {
  192.             if (this.dhtmlList.getSelectedIndex() != this.iface.cur_selection && this.dhtmlList.getSelectedIndex() > -1) {
  193.                this.infoarea.setText(this.iface.appListInfo[1][this.dhtmlList.getSelectedIndex()]);
  194.             }
  195.  
  196.             ACutila.dhtmlList_lastSelection = this.dhtmlList.getSelectedIndex();
  197.             this.iface.cur_selection = this.dhtmlList.getSelectedIndex();
  198.          }
  199.       } else if (var1.id == 1001) {
  200.          if (var1.target == this.select) {
  201.             if (this.iface.cur_selection != -1) {
  202.                this.iface.selectedApplet(this.iface.cur_selection);
  203.                this.iface.dispose();
  204.             } else {
  205.                new OCDialog(ACutila.iface, true, "First select an avaialble applet from the list, then click 'New'", "No Selected Applet");
  206.             }
  207.  
  208.             return true;
  209.          }
  210.  
  211.          if (var1.target == this.template) {
  212.             if (this.iface.cur_selection != -1) {
  213.                new OCAOpnr(this.iface.rawinfo, ACutila.iface, this.iface.rawinfo.getAppletInfo(this.iface.cur_selection)[2], true);
  214.                this.iface.dispose();
  215.             } else {
  216.                new OCDialog(ACutila.iface, true, "First select an avaialble effect from the list, then click 'Template'", "No Selected Applet");
  217.             }
  218.  
  219.             return true;
  220.          }
  221.  
  222.          if (var1.target == this.quit) {
  223.             this.iface.dispose();
  224.             return true;
  225.          }
  226.  
  227.          if (var1.target == this.scroller) {
  228.             this.iface.selectedApplet(0);
  229.             this.iface.dispose();
  230.             return true;
  231.          }
  232.  
  233.          if (var1.target == this.menu) {
  234.             this.iface.selectedApplet(1);
  235.             this.iface.dispose();
  236.             return true;
  237.          }
  238.       }
  239.  
  240.       return super.handleEvent(var1);
  241.    }
  242.  
  243.    public void reshape(int var1, int var2, int var3, int var4) {
  244.       if (var3 * var4 > 0) {
  245.          this.field_0 = new Dimension(var3, var4);
  246.          this.reFigureAll();
  247.          super.reshape(var1, var2, var3, var4);
  248.       }
  249.    }
  250. }
  251.