home *** CD-ROM | disk | FTP | other *** search
/ All for Cell Phones: Sony Ericsson / Sony-Ericsson 2004.iso / Java / Mail For Me / Mail4ME.jar / de / trantor / mail / demo / j2me / SetupScreen.class (.txt) < prev    next >
Encoding:
Java Class File  |  2001-10-21  |  3.6 KB  |  115 lines

  1. package de.trantor.mail.demo.j2me;
  2.  
  3. import javax.microedition.lcdui.ChoiceGroup;
  4. import javax.microedition.lcdui.Command;
  5. import javax.microedition.lcdui.Displayable;
  6. import javax.microedition.lcdui.Form;
  7. import javax.microedition.lcdui.Image;
  8. import javax.microedition.lcdui.TextField;
  9.  
  10. public class SetupScreen extends Form {
  11.    private TextField address = new TextField("Your address:", "", 128, 1);
  12.    private TextField hostname = new TextField("Your hostname:", "", 128, 4);
  13.    String[] names = new String[]{"POP3", "IMAP"};
  14.    private ChoiceGroup services;
  15.    private TextField pop3Host;
  16.    private TextField pop3User;
  17.    private TextField pop3Pass;
  18.    private TextField smtpHost;
  19.    String[] options;
  20.    private ChoiceGroup debug;
  21.    // $FF: renamed from: OK javax.microedition.lcdui.Command
  22.    public static Command field_0 = new Command("Ok", 1, 1);
  23.  
  24.    public SetupScreen(MailMIDlet midlet) {
  25.       super("Setup");
  26.       this.services = new ChoiceGroup("Inbox type:", 1, this.names, (Image[])null);
  27.       this.pop3Host = new TextField("Inbox hostname:", "", 128, 4);
  28.       this.pop3User = new TextField("Inbox username:", "", 128, 0);
  29.       this.pop3Pass = new TextField("Inbox password:", "", 128, 65536);
  30.       this.smtpHost = new TextField("SMTP hostname:", "", 128, 4);
  31.       this.options = new String[]{"Off", "On"};
  32.       this.debug = new ChoiceGroup("Debugging:", 1, this.options, (Image[])null);
  33.       ((Form)this).append(this.address);
  34.       ((Form)this).append(this.hostname);
  35.       ((Form)this).append(this.services);
  36.       ((Form)this).append(this.pop3Host);
  37.       ((Form)this).append(this.pop3User);
  38.       ((Form)this).append(this.pop3Pass);
  39.       ((Form)this).append(this.smtpHost);
  40.       ((Form)this).append(this.debug);
  41.       ((Displayable)this).addCommand(field_0);
  42.       ((Displayable)this).setCommandListener(midlet);
  43.    }
  44.  
  45.    public String getAddress() {
  46.       return this.address.getString();
  47.    }
  48.  
  49.    public String getHostname() {
  50.       return this.hostname.getString();
  51.    }
  52.  
  53.    public boolean getImap() {
  54.       return this.services.isSelected(1);
  55.    }
  56.  
  57.    public String getPop3Host() {
  58.       return this.pop3Host.getString();
  59.    }
  60.  
  61.    public String getPop3User() {
  62.       return this.pop3User.getString();
  63.    }
  64.  
  65.    public String getPop3Pass() {
  66.       return this.pop3Pass.getString();
  67.    }
  68.  
  69.    public boolean getDebug() {
  70.       return this.debug.isSelected(1);
  71.    }
  72.  
  73.    public String getSmtpHost() {
  74.       return this.smtpHost.getString();
  75.    }
  76.  
  77.    public void setAddress(String address) {
  78.       this.address.setString(address);
  79.    }
  80.  
  81.    public void setHostname(String hostname) {
  82.       this.hostname.setString(hostname);
  83.    }
  84.  
  85.    public void setImap(boolean value) {
  86.       if (value) {
  87.          this.services.setSelectedIndex(1, true);
  88.       }
  89.  
  90.    }
  91.  
  92.    public void setPop3Host(String pop3Host) {
  93.       this.pop3Host.setString(pop3Host);
  94.    }
  95.  
  96.    public void setPop3User(String pop3User) {
  97.       this.pop3User.setString(pop3User);
  98.    }
  99.  
  100.    public void setPop3Pass(String pop3Pass) {
  101.       this.pop3Pass.setString(pop3Pass);
  102.    }
  103.  
  104.    public void setSmtpHost(String smtpHost) {
  105.       this.smtpHost.setString(smtpHost);
  106.    }
  107.  
  108.    public void setDebug(boolean value) {
  109.       if (value) {
  110.          this.debug.setSelectedIndex(1, true);
  111.       }
  112.  
  113.    }
  114. }
  115.