Java Reference
In-Depth Information
f
.
pack
();
f
.
setVisible
(
true
true
);
}
}
The
MailComposeBean
used for the Sending tab is a GUI component for composing a mail
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
() {