FileDocCategorySizeDatePackage
SMTPClient.javaAPI DocExample3791Mon Oct 09 13:10:06 BST 2000None

SMTPClient

public class SMTPClient extends JFrame

Fields Summary
private JButton
sendButton
private JLabel
fromLabel
private JLabel
toLabel
private JLabel
hostLabel
private JLabel
subjectLabel
private JTextField
fromField
private JTextField
toField
private JTextField
hostField
private JTextField
subjectField
private JTextArea
message
private JScrollPane
jsp
Constructors Summary
public SMTPClient()


    
    
    super("SMTP Client");
    Container contentPane = this.getContentPane();
    contentPane.setLayout(new BorderLayout());  
    
    JPanel labels = new JPanel();
    labels.setLayout(new GridLayout(4, 1));
    labels.add(hostLabel);
    
    JPanel fields = new JPanel();
    fields.setLayout(new GridLayout(4, 1));
    String host = System.getProperty("mail.host", "");
    hostField.setText(host);
    fields.add(hostField);
    
    labels.add(toLabel);
    fields.add(toField);

    String from = System.getProperty("mail.from", "");
    fromField.setText(from);
    labels.add(fromLabel);
    fields.add(fromField);

    labels.add(subjectLabel);
    fields.add(subjectField);
    
    Box north = Box.createHorizontalBox();
    north.add(labels);
    north.add(fields);
    
    contentPane.add(north, BorderLayout.NORTH);
    
    message.setFont(new Font("Monospaced", Font.PLAIN, 12));
    contentPane.add(jsp, BorderLayout.CENTER);

    JPanel south = new JPanel();
    south.setLayout(new FlowLayout(FlowLayout.CENTER));
    south.add(sendButton);
    sendButton.addActionListener(new SendAction());
    contentPane.add(south, BorderLayout.SOUTH);       
    
    this.pack(); 
    
  
Methods Summary
public static voidmain(java.lang.String[] args)


    SMTPClient client = new SMTPClient();
    // Next line requires Java 1.3. We want to set up the
    // exit behavior here rather than in the constructor since
    // other programs that use this class may not want to exit 
    // the application when the SMTPClient window closes.
    client.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    client.show();