Java Reference
In-Depth Information
f . pack ();
f . setVisible ( true
true );
}
}
The MailReaderBean used in the Reading tab is exactly the same as the one shown in Pro-
gram: MailReaderBean .
The MailComposeBean used for the Sending tab is a GUI component for composing a mail
message. It uses the Mailer class from Mail-Enabling a Server Program to do the actual
sending. Example 17-11 shows the MailComposeBean program.
Example 17-11. MailComposeBean.java
public
public class
class MailComposeBean
MailComposeBean extends
extends JPanel {
/** The parent frame to be hidden/disposed; may be JFrame, JInternalFrame
* or JPanel, as necessary */
private
private Container parent ;
private
private JButton sendButton , cancelButton ;
private
private JTextArea msgText ;
// The message!
// The To, Subject, and CC lines are treated a bit specially,
// any user-defined headers are just put in the tfs array.
private
private JTextField tfs [], toTF , ccTF , subjectTF ;
// tfsMax MUST == how many are current, for focus handling to work
private
private int
int tfsMax = 3 ;
private
private final
final int
int TO = 0 , SUBJ = 1 , CC = 2 , BCC = 3 , MAXTF = 8 ;
/** The JavaMail session object */
private
private Session session = null
null ;
/** The JavaMail message object */
private
private Message mesg = null
null ;
private
private int
int mywidth ;
private
private int
int myheight ;
/** Construct a MailComposeBean with no default recipient */
MailComposeBean ( Container parent , String title , int
int height , int
int width ) {
this
this ( parent , title , null
null , height , width );
}
/** Construct a MailComposeBean with no arguments (needed for Beans) */
MailComposeBean () {
Search WWH ::




Custom Search