Java Reference
In-Depth Information
tp . add ( new
new JLabel ( "Cc: " , JLabel . RIGHT ));
tp . add ( tfs [ CC ] = ccTF = new
new JTextField ( 35 ));
// Center is the TextArea
cp . add ( BorderLayout . CENTER , msgText = new
new JTextArea ( 70 , 10 ));
msgText . setBorder ( BorderFactory . createTitledBorder ( "Message Text" ));
// Bottom is the apply/cancel button
JPanel bp = new
new JPanel ();
bp . setLayout ( new
new FlowLayout ());
bp . add ( sendButton = new
new JButton ( "Send" ));
sendButton . addActionListener ( new
new ActionListener () {
public
public void
void actionPerformed ( ActionEvent e ) {
try
try {
doSend ();
} catch
catch ( Exception err ) {
System . err . println ( "Error: " + err );
JOptionPane . showMessageDialog ( null
null ,
"Sending error:\n" + err . toString (),
"Send failed" , JOptionPane . ERROR_MESSAGE );
}
}
});
bp . add ( cancelButton = new
new JButton ( "Cancel" ));
cancelButton . addActionListener ( new
new ActionListener () {
public
public void
void actionPerformed ( ActionEvent e ) {
maybeKillParent ();
}
});
cp . add ( BorderLayout . SOUTH , bp );
}
public
public Dimension getPreferredSize () {
return
return new
new Dimension ( mywidth , myheight );
}
public
public Dimension getMinimumSize () {
return
return getPreferredSize ();
}
/** Do the work: send the mail to the SMTP server.
*
* ASSERT: must have set at least one recipient.
*/
public
public void
void doSend () {
try
try {
Search WWH ::




Custom Search