event dispaching

2001-01-17 Thread Billy V. Kantartzis


i am to link an application that i have made to a user interface
the application works fine ok on prompt
but  when i link the results to an JTable i get event despaching
errors
does some one have any idea
(i am including a demo tesst programme )
you have to change the servers ana passwor fields
Tia
-- 
Billy Kantartzis 
3rd year computer science,
Isaac Rebow House Flat 3,
University of Essex,
co4 3sq 
Colchester,
Essex,
phone:(+44) 0120653-6483
Mob: 07968151304
 

 import javax.swing.*;
 import java.awt.event.*;

 public class TestPane extends JFrame 
 { 
  

  public TestPane ()
  {
super ("testing the table ");
   }

 public static void main (String[] args)
 {
   TestPane app = new TestPane();
   MessageListPane m = new MessageListPane("vkanta","bk123qaz");
   app.setSize(600,600);
   app.getContentPane().add (m);
   app.setVisible(true);
 }
 } 


/
 *  File: MailReceiver.java
 *  Author:Billy Kantartzis 
 *  E-mail:[EMAIL PROTECTED]
 *  Date:09 jan 2001
 *  Description: 
 *  this is the Receive mail component of the TW GPa application 
 *  it is based on the java mail API.
 *   Purpose:
 * 
 *   Handles the main communication with the mail server and contains
 *   utility methods returning information conserning the mail sysytem
 *   and messages in a way that are easily presented on a  GUI
 ***/ 

import java.io.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class MailReceiver 
{
/* Connection and user settinggs */

 private String protocol; 
 private static String host;
 private static int  messageNo;
 private  String user;
 private String password;
 private String mbox;
 private Properties props; 
 private Session session; 
 private Store store ;
 private Folder folder;
 private UIDFolder uidFolder;
 private Part part;

/* message info */
 private Message[] mesg;
 private int messages=0 , newMesg=0;
 private long uid=-1;// no messages are read
/
 * constructor *
 ***/
 
public  MailReceiver( String user, String pass)
  {
/* this constructor builds a connection tothe remote system
 * and then acesses a folder*/


messageNo=0;
this.protocol="imap";
this.host="sh622.essex.ac.uk";
this.user=user;
password=pass;
mbox="INBOX";// default folder name
props=System.getProperties();
session=Session.getDefaultInstance(props,null);
this.connect();
this.process();

  } // end constructor 





/
 * connect *
 ***/
  void connect ()
  {
  /**
connect handles the connection to the server and setup mail folder 
information*/
try 
{
System.out.println ("trying to login to "+ host);
 store =session.getStore (protocol);
 store.connect(host,user,password);
}catch (MessagingException e0)
{
 System.out.println ("invalid user/pass");
  System.out.println (user +  " " + password);
 e0.printStackTrace();
}// end catch 

  }// end connect 

/
 * Process  *
 /  
  void process ()

  {
   /** 
 - set up the default folder where we read messages from.
 - set up the fetch profile for the messages  
  */
/* try to open the the folder where messages are 
   held*/
  try 
 {
 // open the default folder
 folder=store.getFolder(mbox); //get the message folder
 folder.open(Folder.READ_WRITE);   // we are trying to open the folder r/w

}catch (MessagingException e1)
{
 System.out.println ("unanble to open folder");
 e1.printStackTrace();
}// end catch 

  /* get the number of messages and set the fetch profile
  */ 
   try
{
 messages=folder.getMessageCount(); // read the total number of messages
 newMesg=folder.getNewMessageCount();// read how many new messages we have
  prepMsgGet();   // prepaere to receive messages

}
catch (MessagingException e1)
 {
   e1.printStackTrace();
 }
  }// end process

  /***
   * getMessages* 
   **/
public int getMessages() 
{
 /**
   this method returns the number the number of messages
   in a folder 
*/
   return (messages);
}

  /***
   * getNewMessages* 
   **/

public int getNewMessages() 
{
 /**
   Returns the number of  new messages
   on a system
 */ 
   return (newMesg);
}
  

  /***
   * adrToStr* 
   **/

   public String adrToStr(Address[] adrs) throws MessagingException
   {
  /**
 convert internet address into String
 so that can be easily displayed on a text component 
 (i.e textArea textFields)
  */
int i ;
StringBuffer b = ne

JNI and command-line arguments

2001-01-17 Thread soonho



Dear sir, I have a C program running 
in Linux using command line argument - main (int argc, char *argv[]). How to use 
JNI to call this command-line argument? I need to use JNI cause my C program 
involve OS-specific function. Is Innovation API - creating VM will solve this 
problem. I heard that Innovation API is not fully supported in Linux. Is it 
true in JDK1.3?
 
where to the location of classpath field in JDK1.3. 
vm_args.classpath = ??  In order tomake it clear, i 
accompany a simple C command-line argument program. Thank you very much. 
 Regards soonho  #include 
 main (int argc, char *argv[]) { int count; 
printf("Program name:%s\n",argv[0]);  if (argc>1) { 
for (count=1;countprintf("Argument%d:%s\n,count,argv[count]); } else puts("No 
command line arguments entered.");  return (0); }