Java Reference
In-Depth Information
// The Southern (Bottom) child is a textarea to display the msg.
bodyText = new
new JTextArea ( 15 , 80 );
this
this . setBottomComponent ( new
new JScrollPane ( bodyText ));
// Add a notification listener for the tree; this will
// display the clicked-upon message
TreeSelectionListener tsl = new
new TreeSelectionListener () {
public
public void
void valueChanged ( TreeSelectionEvent evt ) {
Object [] po = evt . getPath (). getPath ();
// yes, repeat it.
Object o = po [ po . length - 1 ];
// last node in path
iif ( o instanceof
instanceof FolderNode ) {
// System.out.println("Select folder " + o.toString());
return
return ;
}
iif ( o instanceof
instanceof MessageNode ) {
bodyText . setText ( "" );
try
try {
Message m = (( MessageNode ) o ). m ;
bodyText . append ( "To: " );
Object [] tos = m . getAllRecipients ();
for
for ( Object to : tos ) {
bodyText . append ( to . toString ());
bodyText . append ( " " );
}
bodyText . append ( "\n" );
bodyText . append ( "Subject: " + m . getSubject () + "\n" );
bodyText . append ( "From: " );
Object [] froms = m . getFrom ();
for
for ( Object from : froms ) {
bodyText . append ( from . toString ());
bodyText . append ( " " );
}
bodyText . append ( "\n" );
bodyText . append ( "Date: " + m . getSentDate () + "\n" );
bodyText . append ( "\n" );
bodyText . append ( m . getContent (). toString ());
// Start reading at top of message(!)
bodyText . setCaretPosition ( 0 );
} catch
catch ( Exception e ) {
bodyText . append ( e . toString ());
Search WWH ::




Custom Search