home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 October / PCO1097.ISO / FilesBBS / WIN95 / IAVAZIP.EXE / DATA.Z / About.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-08-18  |  4.7 KB  |  147 lines

  1. package com.sfs.iavazip;
  2.  
  3. import com.sfs.awt.Picture;
  4. import com.sfs.awt.TexturePanel;
  5. import com.sfs.util.Reg;
  6. import java.awt.AWTEvent;
  7. import java.awt.BorderLayout;
  8. import java.awt.Button;
  9. import java.awt.Color;
  10. import java.awt.Component;
  11. import java.awt.Container;
  12. import java.awt.Dialog;
  13. import java.awt.FlowLayout;
  14. import java.awt.GridLayout;
  15. import java.awt.Image;
  16. import java.awt.Label;
  17. import java.awt.Panel;
  18. import java.awt.Rectangle;
  19. import java.awt.Window;
  20. import java.awt.event.ActionEvent;
  21. import java.awt.event.ActionListener;
  22. import java.awt.event.WindowEvent;
  23.  
  24. public class About extends Dialog implements ActionListener {
  25.    iavaZip mainApp;
  26.    boolean retCode = true;
  27.    PurchasePanel purchase;
  28.    LicensePanel license;
  29.    FailedPanel failed;
  30.    GrantedPanel granted;
  31.    Panel about;
  32.    Panel lastPanel;
  33.  
  34.    protected void processWindowEvent(WindowEvent var1) {
  35.       switch (((AWTEvent)var1).getID()) {
  36.          case 201:
  37.             this.retCode = false;
  38.             ((Window)this).dispose();
  39.             return;
  40.          default:
  41.       }
  42.    }
  43.  
  44.    public void actionPerformed(ActionEvent var1) {
  45.       String var2 = var1.getActionCommand();
  46.       ((Container)this).remove(this.lastPanel);
  47.       if (var2.equals("OK")) {
  48.          this.retCode = false;
  49.          ((Window)this).dispose();
  50.       }
  51.  
  52.       if (var2.equals("Purchase a license")) {
  53.          ((Dialog)this).setTitle("Purchase a license");
  54.          ((Container)this).add("Center", this.lastPanel = this.purchase);
  55.       }
  56.  
  57.       if (var2.equals("Cancel")) {
  58.          if (this.lastPanel == this.purchase) {
  59.             ((Dialog)this).setTitle("About");
  60.             ((Container)this).add("Center", this.lastPanel = this.about);
  61.          } else if (this.lastPanel == this.license) {
  62.             ((Container)this).add("Center", this.lastPanel = this.purchase);
  63.          }
  64.       }
  65.  
  66.       if (var2.equals("License iavaZIP")) {
  67.          ((Dialog)this).setTitle("Purchase a license");
  68.          ((Container)this).add("Center", this.lastPanel = this.license);
  69.       }
  70.  
  71.       if (var2.equals("License iavaZIP now")) {
  72.          if (Reg.isSerialRegcode(this.license.registrationCode.getText())) {
  73.             this.mainApp.properties.put("user.Name", this.license.userName.getText());
  74.             this.mainApp.properties.put("user.Code", this.license.registrationCode.getText());
  75.             ((Dialog)this).setTitle("License granted");
  76.             this.granted.setUserData(this.license.userName.getText(), this.license.registrationCode.getText());
  77.             ((Container)this).add("Center", this.granted);
  78.          } else {
  79.             ((Container)this).add("Center", this.lastPanel = this.failed);
  80.          }
  81.       }
  82.  
  83.       if (var2.equals("OK")) {
  84.          this.retCode = true;
  85.          ((Window)this).dispose();
  86.       }
  87.  
  88.       if (var2.equals("Back")) {
  89.          ((Dialog)this).setTitle("Purchase a license");
  90.          ((Container)this).add("Center", this.lastPanel = this.license);
  91.       }
  92.  
  93.       ((Window)this).pack();
  94.    }
  95.  
  96.    About(iavaZip var1) {
  97.       super(var1, "About iavaZip", true);
  98.       this.mainApp = var1;
  99.       ((Container)this).setLayout(new BorderLayout());
  100.       this.about = new Panel();
  101.       this.about.setLayout(new BorderLayout());
  102.       TexturePanel var2 = new TexturePanel(this, var1.backgroundTexture);
  103.       Image var3 = ((Window)this).getToolkit().getImage(this.getClass().getResource("logo.gif"));
  104.       ((Window)this).getToolkit().prepareImage(var3, -1, -1, this);
  105.       ((Container)var2).add(new Picture(this, var3, true));
  106.       this.about.add("Center", var2);
  107.       TexturePanel var4 = new TexturePanel(this, var1.backgroundTexture);
  108.       ((Container)var4).setLayout(new FlowLayout());
  109.       Button var5 = new Button("OK");
  110.       ((Container)var4).add(var5);
  111.       var5.addActionListener(this);
  112.       Panel var6 = new Panel();
  113.       ((Container)var6).setLayout(new GridLayout(2, 1));
  114.       Label var7 = new Label("This version is not licensed.", 1);
  115.       if (var1.properties.getProperty("user.Name") != null) {
  116.          var7.setText("Licensed for: " + var1.properties.getProperty("user.Name"));
  117.       } else {
  118.          var5 = new Button("Purchase a license");
  119.          ((Container)var4).add(var5);
  120.          var5.addActionListener(this);
  121.       }
  122.  
  123.       ((Component)var7).setBackground(Color.gray);
  124.       ((Container)var6).add(var7);
  125.       ((Container)var6).add(var4);
  126.       this.about.add("South", var6);
  127.       ((Container)this).add("Center", this.lastPanel = this.about);
  128.       ((Window)this).pack();
  129.       this.purchase = new PurchasePanel(var1, this);
  130.       this.license = new LicensePanel(var1, this);
  131.       this.granted = new GrantedPanel(var1, this);
  132.       this.failed = new FailedPanel(var1, this);
  133.       ((Component)this).enableEvents(64L);
  134.    }
  135.  
  136.    public boolean doModal() {
  137.       ((Window)this).pack();
  138.       Rectangle var1 = ((Component)this).getParent().getBounds();
  139.       Rectangle var2 = ((Component)this).getBounds();
  140.       var2.x = var1.x + (var1.width - var2.width) / 2;
  141.       var2.y = var1.y + (var1.height - var2.height) / 2;
  142.       ((Component)this).setBounds(var2);
  143.       ((Dialog)this).show();
  144.       return this.retCode;
  145.    }
  146. }
  147.