

import java.util.ResourceBundle;

import javax.swing.table.AbstractTableModel;


public class TableModelClass1 extends AbstractTableModel
{
	void updateDisplay(ResourceBundle res)
	{
		snumber=res.getString("snumber");
		sender=res.getString("sender");
		subject=res.getString("subject");
		date=res.getString("date");
	}
	
	public int getRowCount() 
	{
		try
		{
		
		return client.meassagesInInbox();
		}
		catch(Exception e)
		{
			e.printStackTrace();
			return 0;
			
		}
	}

	public int getColumnCount()
	{
		
		return 4;
	}

	public Object getValueAt(int row, int col)
	{
		if(col==0)
		{
			return  new Integer(row+1);
		}
		if(col==1)
		{
			try
			{
				return client.senderInfo(row);
			}
			catch(Exception e)
			{
				e.printStackTrace();
				return null;
				
				
			}
		}
		if(col==2)
		{
			try
			{
				return client.subjectInfo(row);
			}
			catch(Exception e)
			{
				e.printStackTrace();
				return null;
				
				
			}
		}
		
		if(col==3)
		{
			try
			{
				return client.dateInfo(row);
			}
			catch(Exception e)
			{
				e.printStackTrace();
				return null;
				
				
			}
		}
		else
		return null;
	}
	public String getColumnName(int c)
	{
		if(c==0)
			return snumber;
	
		if(c==1)
		{
		
			return sender;
		}
		if(c==2)
		{
	
			return subject;
		}
		if(c==3)
		{
		
			return date ;
		}
	
		else
			return "";
		
	}
	
	
	private static MailClientClass1 client  = new MailClientClass1(System.getProperty("user.name"),System.getProperty("user.name"),"localhost"); ;
	private static String snumber="\u0938\u0902\u0959\u092f\u093e";
	private static String sender="\u092d\u0947\u091c\u0928\u0947\u0020\u0935\u093e\u0932\u093e";
	private static String subject="\u0935\u093f\u0937\u092f";
	private static String date="\u0926\u093f\u0928\u093e\u0902\u0915";

	
}
