home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Java / JDesignerPro / Jdp3_0.exe / data1.cab / Program_Files / JDPMain.jar / EmailMyFriend.class (.txt) next >
Encoding:
Java Class File  |  1998-08-21  |  6.3 KB  |  208 lines

  1. import java.awt.BorderLayout;
  2. import java.awt.Container;
  3. import java.awt.Event;
  4. import java.awt.Font;
  5. import java.awt.Label;
  6. import java.awt.Panel;
  7. import java.awt.TextArea;
  8. import java.awt.TextField;
  9.  
  10. public class EmailMyFriend extends JDPClassLayout {
  11.    JDPUser user;
  12.    JDPJagg jaggSQL;
  13.    JDPPopupMessage popuppanel;
  14.    JDPMaskEdit JDPMaskEditMain;
  15.    String moduleParameter;
  16.    Panel Main;
  17.    JDPEmailSender EMail1;
  18.    JDPChiselFramePanel ChiselPanel1;
  19.    Panel Panel1;
  20.    JDPScrollPanel ScrollPanel2;
  21.    Label Label6;
  22.    Label Label7;
  23.    Label Label8;
  24.    Label Label9;
  25.    TextField fromAddress;
  26.    Label Label2;
  27.    TextField toAddress;
  28.    Label Label3;
  29.    TextField firstName;
  30.    Label Label1;
  31.    TextArea messageText;
  32.    JDPButtons JDPButtons1;
  33.    Label Label4;
  34.    TextField mailServer;
  35.  
  36.    public void InitClass(JDPUser var1, Panel var2, String var3) {
  37.       this.user = var1;
  38.       this.moduleParameter = var3;
  39.       super.targetPanel = var2;
  40.       this.jaggSQL = new JDPJagg(var1.jaggPath);
  41.       ((Container)this).setLayout(new BorderLayout());
  42.       this.popuppanel = new JDPPopupMessage(var1, this);
  43.       ((Container)this).add(this.popuppanel);
  44.       this.JDPMaskEditMain = new JDPMaskEdit();
  45.       this.Main = new Panel();
  46.       this.EMail1 = new JDPEmailSender(var1);
  47.       this.ChiselPanel1 = new JDPChiselFramePanel(var1, "Tell a friend about JDesignerPro!");
  48.       this.Panel1 = new Panel();
  49.       this.ScrollPanel2 = new JDPScrollPanel();
  50.       this.Label6 = new Label("Simply enter the information below and", 0);
  51.       this.Label7 = new Label("a message will be sent to your friend", 0);
  52.       this.Label8 = new Label("telling them all about JDesignerPro.", 0);
  53.       this.Label9 = new Label("Enter your email address:", 0);
  54.       this.fromAddress = new TextField("", 30);
  55.       this.Label2 = new Label("Your friend's email address:", 0);
  56.       this.toAddress = new TextField("", 30);
  57.       this.Label3 = new Label("Your friend's first name:", 0);
  58.       this.firstName = new TextField("", 30);
  59.       this.Label1 = new Label("Add a personal note:", 0);
  60.       this.messageText = new TextArea("", 6, 31);
  61.       String[] var4 = new String[]{"Send"};
  62.       int[] var5 = new int[]{JDPButton.getIconValue("Email")};
  63.       this.JDPButtons1 = new JDPButtons(var1, var4, var5, JDPButtons.getAlignmentValue("Horizontal"));
  64.       this.Label4 = new Label("Enter your mailserver (only if send fails):", 0);
  65.       this.mailServer = new TextField("mail", 30);
  66.       this.Main.setLayout(new BorderLayout());
  67.       ((Container)this).add("Center", this.Main);
  68.       this.Main.add("West", this.ChiselPanel1);
  69.       this.ChiselPanel1.add("Center", this.Panel1);
  70.       this.Panel1.setLayout(new BorderLayout());
  71.       this.Panel1.add("North", this.ScrollPanel2);
  72.       this.ScrollPanel2.add("Left", this.Label6);
  73.       this.ScrollPanel2.add("Left", this.Label7);
  74.       this.ScrollPanel2.add("Left", this.Label8);
  75.       this.ScrollPanel2.add("Left", this.Label9);
  76.       this.ScrollPanel2.add("Left", this.fromAddress);
  77.       this.ScrollPanel2.add("Left", this.Label2);
  78.       this.ScrollPanel2.add("Left", this.toAddress);
  79.       this.ScrollPanel2.add("Left", this.Label3);
  80.       this.ScrollPanel2.add("Left", this.firstName);
  81.       this.ScrollPanel2.add("Left", this.Label1);
  82.       this.ScrollPanel2.add("Left", this.messageText);
  83.       this.ScrollPanel2.add("Left", this.JDPButtons1);
  84.       this.ScrollPanel2.add("Left", this.Label4);
  85.       this.ScrollPanel2.add("Left", this.mailServer);
  86.       this.Label6.setFont(new Font("Helvetica", 0, 11));
  87.       this.Label6.setForeground(var1.u._cvtcolor("Black"));
  88.       this.Label6.setBackground(var1.u._cvtcolor("LightGray"));
  89.       this.Label7.setFont(new Font("Helvetica", 0, 11));
  90.       this.Label7.setForeground(var1.u._cvtcolor("Black"));
  91.       this.Label7.setBackground(var1.u._cvtcolor("LightGray"));
  92.       this.Label8.setFont(new Font("Helvetica", 0, 11));
  93.       this.Label8.setForeground(var1.u._cvtcolor("Black"));
  94.       this.Label8.setBackground(var1.u._cvtcolor("LightGray"));
  95.       this.fromAddress.setFont(new Font("Helvetica", 0, 11));
  96.       this.fromAddress.setForeground(var1.u._cvtcolor("Black"));
  97.       this.fromAddress.setBackground(var1.u._cvtcolor("White"));
  98.       this.Label2.setFont(new Font("Helvetica", 0, 11));
  99.       this.Label2.setForeground(var1.u._cvtcolor("Black"));
  100.       this.Label2.setBackground(var1.u._cvtcolor("LightGray"));
  101.       this.toAddress.setFont(new Font("Helvetica", 0, 11));
  102.       this.toAddress.setForeground(var1.u._cvtcolor("Black"));
  103.       this.toAddress.setBackground(var1.u._cvtcolor("White"));
  104.       this.Label3.setFont(new Font("Helvetica", 0, 11));
  105.       this.Label3.setForeground(var1.u._cvtcolor("Black"));
  106.       this.Label3.setBackground(var1.u._cvtcolor("LightGray"));
  107.       this.firstName.setFont(new Font("Helvetica", 0, 11));
  108.       this.firstName.setForeground(var1.u._cvtcolor("Black"));
  109.       this.firstName.setBackground(var1.u._cvtcolor("White"));
  110.       this.Label1.setFont(new Font("Helvetica", 0, 11));
  111.       this.Label1.setForeground(var1.u._cvtcolor("Black"));
  112.       this.Label1.setBackground(var1.u._cvtcolor("LightGray"));
  113.       this.messageText.setFont(new Font("Helvetica", 0, 11));
  114.       this.messageText.setForeground(var1.u._cvtcolor("Black"));
  115.       this.messageText.setBackground(var1.u._cvtcolor("White"));
  116.       this.JDPButtons1.setFont(new Font("Helvetica", 0, 11));
  117.       this.JDPButtons1.setForeground(var1.u._cvtcolor("Black"));
  118.       this.JDPButtons1.setBackground(var1.u._cvtcolor("LightGray"));
  119.       this.Label4.setFont(new Font("Helvetica", 0, 11));
  120.       this.Label4.setForeground(var1.u._cvtcolor("Black"));
  121.       this.Label4.setBackground(var1.u._cvtcolor("LightGray"));
  122.       this.mailServer.setFont(new Font("Helvetica", 0, 11));
  123.       this.mailServer.setForeground(var1.u._cvtcolor("Black"));
  124.       this.mailServer.setBackground(var1.u._cvtcolor("White"));
  125.       var1.gParm.addElement(this);
  126.       this.InitComponents();
  127.    }
  128.  
  129.    public boolean handleEvent(Event var1) {
  130.       switch (var1.id) {
  131.          case 401:
  132.             if (var1.key == 9 && var1.modifiers != 1) {
  133.                if (var1.target.equals(this.fromAddress)) {
  134.                   this.user.u.cursor(this.toAddress);
  135.                }
  136.  
  137.                if (var1.target.equals(this.toAddress)) {
  138.                   this.user.u.cursor(this.firstName);
  139.                }
  140.  
  141.                if (var1.target.equals(this.firstName)) {
  142.                   this.user.u.cursor(this.messageText);
  143.                }
  144.  
  145.                if (var1.target.equals(this.messageText)) {
  146.                   this.user.u.cursor(this.mailServer);
  147.                }
  148.  
  149.                if (var1.target.equals(this.mailServer)) {
  150.                   this.user.u.cursor(this.fromAddress);
  151.                }
  152.             }
  153.  
  154.             if (var1.key == 9 && var1.modifiers == 1) {
  155.                if (var1.target.equals(this.fromAddress)) {
  156.                   this.user.u.cursor(this.mailServer);
  157.                   return true;
  158.                }
  159.  
  160.                if (var1.target.equals(this.toAddress)) {
  161.                   this.user.u.cursor(this.fromAddress);
  162.                   return true;
  163.                }
  164.  
  165.                if (var1.target.equals(this.firstName)) {
  166.                   this.user.u.cursor(this.toAddress);
  167.                   return true;
  168.                }
  169.  
  170.                if (var1.target.equals(this.messageText)) {
  171.                   this.user.u.cursor(this.firstName);
  172.                   return true;
  173.                }
  174.  
  175.                if (var1.target.equals(this.mailServer)) {
  176.                   this.user.u.cursor(this.messageText);
  177.                   return true;
  178.                }
  179.             }
  180.  
  181.             return false;
  182.          case 503:
  183.          case 504:
  184.          case 505:
  185.             this.popuppanel.postEvent(var1);
  186.             return false;
  187.          case 1001:
  188.             if (var1.target.equals(this.JDPButtons1.button[0])) {
  189.                this.EMail1.setMailServer(this.mailServer.getText());
  190.                this.EMail1.setToAddress(this.toAddress.getText());
  191.                this.EMail1.setMessageSubject("Check out this Java tool");
  192.                this.EMail1.setReturnAddress(this.fromAddress.getText());
  193.                String var2 = this.firstName.getText() + ",\n\nI started using JDesignerPro, a Java Rapid Application Development tool\nthat I thought you might be interested in. You should check it out at\nhttp://www.bulletproof.com/. There's a free trial download.\n\n";
  194.                this.EMail1.setMessage(var2 + this.messageText.getText());
  195.                this.EMail1.sendSingleMessage();
  196.                return true;
  197.             }
  198.  
  199.             return false;
  200.          default:
  201.             return false;
  202.       }
  203.    }
  204.  
  205.    public void InitComponents() {
  206.    }
  207. }
  208.