Hey guys iv got this project to make an address book that has all kinds of functions and iv got them all working apart from one bit, it needs to be able to read a file when it opens as well as import other data from other files.

The data comes in the following format:
Tony Hancock
01202719029
07676101393
1 Charminster Road, Bournemouth, Dorset, BH8 8UE
Auberon Waugh
01823810098
None
Combe Florey House, Combe Florey, Somerset, TA4 3JD

so name, home number, mobile number and then address.

i have been trying to bufferedread the file in and then add the details to an arrayList which i then need to set up a loop to catch the first index which would be the name then link that to the Jtable name section (textFirstName and textLastName) somehow, then repeat that for another 3 index's till index 3 and start again, BUT how do i do that????

any help would be great guys, im so close to finishing and got very little time left.

Thanks

heres my code so far:

public class Q3 implements ActionListener
{
	
   	JFrame addressBook;   	
   	JFrame contacts;
   	JList theList;
   	DefaultTableModel tableModel;
   	
   	
      	
   	JLabel labFirstName, labLastName, labAddress, labPhone, labMob, searchTitle;
   	JTextField textFirstName, textLastName, textAddress, textPhone, textMob, contactsTextArea;
   	JButton buttonSave, buttonDelete, buttonImport, buttonSearch, buttonExit, buttonReset;
    
    
   	
   	String name, address, allContacts;
	
   	int phone, mob;
   	int recordNumber;	 // used to naviagate using >> and << buttons 
   	Container container1, container2;   	
   	JPanel panel1;
   	JMenuBar menu_bar;
   	JMenu file;
   	JMenuItem exit;
   	JMenuItem open;
   	JScrollPane scroller;
   	JTable table;
   	
   	ArrayList<contact> people = new ArrayList<contact>();
   	TableRowSorter <DefaultTableModel> sorter;
   	
   	
   	
   	
   	
   	   	
   	
   	
   	public static void main(String args[]) throws Exception
   	
   	{
      new Q3(); 	  
    }
   	
   	public Q3() throws Exception
    { 	
 	    name    = "";
 	    address = "";
 	    phone   = -1 ;		//Stores 0 to indicate no Phone Number
 	    mob = -1;
 	    recordNumber = -1;
 	
 	    createGUI();
 	    createContactsFrame();
 	    createTable();
 	    readFromFile();
 	  	
 	  	
 	}
   	
   	public void createTable()
   	{
   		tableModel = new DefaultTableModel();
   		table = new JTable (tableModel);
   		tableModel.addColumn("Name");
   		tableModel.addColumn("Address");
   		tableModel.addColumn("Home Number");
   		tableModel.addColumn("Mobile Number");
   		table.setAutoCreateRowSorter(true);
   		table.setVisible(true);
   		
   		tableModel.addRow(new Object[] 
   				{"Mary Robinson", "85 Brick Road", "0123481244", "07813538241"});
   		
   		tableModel.addRow(new Object[]
   		        {"Alison Jones", "17 Lemar Street", "02084579121", "07753985712"});
   	               	            
   		table.setPreferredScrollableViewportSize(new Dimension(500, 100));
   	    table.setFillsViewportHeight(true);
   	    
   	    scroller = new JScrollPane(table);
   	    panel1.add(scroller);
   	  
   	    sorter = new TableRowSorter <DefaultTableModel>(tableModel);
   	    table.setRowSorter(sorter);
   	    
   	    
   	 
   	}
   	
   
   		
   	
   	
   	public void createContactsFrame()
   	{
   				
   		//set frame characteristics
   		contacts = new JFrame("Contacts");        
   		contacts.setSize(525,300);                            
   		contacts.setVisible(true);
   		contacts.setResizable(false);
   		contacts.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   		
   		//set panel to hold components   		
   		panel1 = new JPanel();
   		contacts.getContentPane().add(panel1);
   		panel1.setBackground(Color.BLACK);
   		
   		
   		menu_bar = new JMenuBar();
   		contacts.setJMenuBar(menu_bar);
   		file = new JMenu ("File");
   		menu_bar.add(file);
   		exit = new JMenuItem ("Exit");
   		file.add(exit);
   		exit.addActionListener(this);
   		open = new JMenuItem ("Open");
   		file.add(open);
   		open.addActionListener(this);
   		   		
   	}
   	
	

	public void createGUI()
   	{

   		/*Create a frame, get its contentpane and set layout*/
   		addressBook = new JFrame("Address Book");
   		addressBook.setSize(300,300);
   		addressBook.setResizable(false);
   		addressBook.setVisible(true);
   		addressBook.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 		   		
   		container1 = addressBook.getContentPane();
   		container1.setLayout(new GridBagLayout());
   		container1.setBackground(Color.black);
   		container1.setSize(300, 300);
   		
   		menu_bar = new JMenuBar();
   		addressBook.setJMenuBar(menu_bar);
   		file = new JMenu ("File");
   		menu_bar.add(file);
   		exit = new JMenuItem ("Exit");
   		file.add(exit);
   		exit.addActionListener(this);
   	
   		
   		  		
   		//Arrange components on contentPane and set Action Listeners to each JButton
   		arrangeComponents();  
   		
   		
   		addressBook.setVisible(true);

   	}
   	public void arrangeComponents()
   	{
   		
   		
   		labFirstName = new JLabel("First Name");
   		labFirstName.setForeground(Color.white);
   		
   		labLastName = new JLabel("Last Name");
   		labLastName.setForeground(Color.white);
   		   		
   		labAddress = new JLabel("Address");
   		labAddress.setForeground(Color.white);
   		
   		labPhone = new JLabel("Home Number");
   		labPhone.setForeground(Color.white);
   		
   		labMob = new JLabel("Mobile Number");
   		labMob.setForeground(Color.white);   		
   		
   		textFirstName    = new JTextField(20);
   		textLastName = new JTextField(20);
   		textAddress = new JTextField(20);
   		textPhone   = new JTextField(20);
   		textMob   = new JTextField(20);

   		buttonSave   = new JButton("Save");
   		buttonDelete = new JButton("Delete");
   		buttonSearch = new JButton("Search");
   		buttonImport = new JButton("Import");

   		buttonReset = new JButton("Reset");
   		buttonExit    = new JButton("Exit");

   		/*add all initialized components to the container*/
   		GridBagConstraints gridBagConstraintsx01 = new GridBagConstraints();
        gridBagConstraintsx01.gridx = 0;
        gridBagConstraintsx01.gridy = 0;
        gridBagConstraintsx01.insets = new Insets(5,5,5,5); 
        container1.add(labFirstName, gridBagConstraintsx01);
        
        GridBagConstraints gridBagConstraintsx02 = new GridBagConstraints();
        gridBagConstraintsx02.gridx = 1;
        gridBagConstraintsx02.insets = new Insets(5,5,5,5); 
        gridBagConstraintsx02.gridy = 0;
        gridBagConstraintsx02.gridwidth = 2;
        gridBagConstraintsx02.fill = GridBagConstraints.BOTH;
        container1.add(textFirstName, gridBagConstraintsx02);
        
        GridBagConstraints gridBagConstraintsx03 = new GridBagConstraints();
        gridBagConstraintsx03.gridx = 0;
        gridBagConstraintsx03.insets = new Insets(5,5,5,5); 
        gridBagConstraintsx03.gridy = 2;
        container1.add(labAddress, gridBagConstraintsx03);
        
        GridBagConstraints gridBagConstraintsx04 = new GridBagConstraints();
        gridBagConstraintsx04.gridx = 1;
        gridBagConstraintsx04.insets = new Insets(5,5,5,5); 
        gridBagConstraintsx04.gridy = 2;
        gridBagConstraintsx04.gridwidth = 2;
        gridBagConstraintsx04.fill = GridBagConstraints.BOTH;
        container1.add(textAddress, gridBagConstraintsx04);
        
        GridBagConstraints gridBagConstraintsx05 = new GridBagConstraints();
        gridBagConstraintsx05.gridx = 0;
        gridBagConstraintsx05.insets = new Insets(5,5,5,5); 
        gridBagConstraintsx05.gridy = 3;
        container1.add(labPhone, gridBagConstraintsx05);
        
        GridBagConstraints gridBagConstraintsx06 = new GridBagConstraints();
        gridBagConstraintsx06.gridx = 1;
        gridBagConstraintsx06.gridy = 3;
        gridBagConstraintsx06.insets = new Insets(5,5,5,5); 
        gridBagConstraintsx06.gridwidth = 2;
        gridBagConstraintsx06.fill = GridBagConstraints.BOTH;
        container1.add(textPhone, gridBagConstraintsx06);
        
        GridBagConstraints gridBagConstraintsx07 = new GridBagConstraints();
        gridBagConstraintsx07.gridx = 0;
        gridBagConstraintsx07.insets = new Insets(5,5,5,5); 
        gridBagConstraintsx07.gridy = 4;
        container1.add(labMob, gridBagConstraintsx07);
        
        GridBagConstraints gridBagConstraintsx08 = new GridBagConstraints();
        gridBagConstraintsx08.gridx = 1;
        gridBagConstraintsx08.gridy = 4;
        gridBagConstraintsx08.gridwidth = 2;
        gridBagConstraintsx08.insets = new Insets(5,5,5,5); 
        gridBagConstraintsx08.fill = GridBagConstraints.BOTH;
        container1.add(textMob, gridBagConstraintsx08);
        
        GridBagConstraints gridBagConstraintsx15 = new GridBagConstraints();
        gridBagConstraintsx15.gridx = 0;
        gridBagConstraintsx15.gridy = 1;
        gridBagConstraintsx15.insets = new Insets(5,5,5,5); 
        container1.add(labLastName, gridBagConstraintsx15);
        
        GridBagConstraints gridBagConstraintsx12 = new GridBagConstraints();
        gridBagConstraintsx12.gridx = 1;
        gridBagConstraintsx12.gridy = 1;
        gridBagConstraintsx12.insets = new Insets(5,5,5,5); 
        gridBagConstraintsx12.gridwidth = 2;
        gridBagConstraintsx12.fill = GridBagConstraints.BOTH;
        container1.add(textLastName, gridBagConstraintsx12);
        
        GridBagConstraints gridBagConstraintsx09 = new GridBagConstraints();
        gridBagConstraintsx09.gridx = 0;
        gridBagConstraintsx09.gridy = 5;
        gridBagConstraintsx09.insets = new Insets(5,5,5,5); 
        container1.add(buttonSave, gridBagConstraintsx09);
        
        GridBagConstraints gridBagConstraintsx10 = new GridBagConstraints();
        gridBagConstraintsx10.gridx = 1;
        gridBagConstraintsx10.gridy = 5;
        gridBagConstraintsx10.insets = new Insets(5,5,5,5); 
        container1.add(buttonDelete, gridBagConstraintsx10);
        
        GridBagConstraints gridBagConstraintsx11 = new GridBagConstraints();
        gridBagConstraintsx11.gridx = 2;
        gridBagConstraintsx11.gridy = 5;
        gridBagConstraintsx11.insets = new Insets(5,5,5,5); 
        container1.add(buttonImport, gridBagConstraintsx11);
                
        
        
        GridBagConstraints gridBagConstraintsx13 = new GridBagConstraints();
        gridBagConstraintsx13.gridx = 0;
        gridBagConstraintsx13.gridy = 6;
        gridBagConstraintsx13.insets = new Insets(5,5,5,5); 
        container1.add(buttonSearch, gridBagConstraintsx13);
        
        GridBagConstraints gridBagConstraintsx14 = new GridBagConstraints();
        gridBagConstraintsx14.gridx = 1;
        gridBagConstraintsx14.gridy = 6;
        gridBagConstraintsx14.insets = new Insets(5,5,5,5); 
        container1.add(buttonReset, gridBagConstraintsx14);
                
        GridBagConstraints gridBagConstraintsx16 = new GridBagConstraints();
        gridBagConstraintsx16.gridx = 2;
        gridBagConstraintsx16.gridy = 6;
        gridBagConstraintsx16.insets = new Insets(5,5,5,5); 
        container1.add(buttonExit, gridBagConstraintsx16);
        
        
        
       
        
        buttonExit.addActionListener(this);
        buttonSave.addActionListener(this);
        buttonDelete.addActionListener(this);
        buttonSearch.addActionListener(this);
        buttonReset.addActionListener(this);
        
        
   	}
   	
   	public void saveToFile()
   	{
   		FileWriter output;
   	 
		try
		{
			output = new FileWriter(new File( "contactFile.txt" ) );
			//output.writeObject(people);
			for (int i = 0; i < people.size(); i++)
			{
				contact c = people.get(i);
				output.write(c.getFirstName() + " " + c.getLastName() + "\n");
				output.write(c.getHomeNumber() + "\n");
				output.write(c.getMobileNumber() + "\n");
				output.write(c.getAddress() + "\n");
			}
			output.close();
		} 
		catch (IOException ioException)
		{
			System.err.println( "Error." );
		} 

   	}
   	
   	
	public void readFromFile () throws Exception
   	{
   		// open file with bufferedreader
   		// while ()
   		//   check 
   		// counter....... number of lines per contact is 4, name,home number, mobile number, address.
   		
   		ArrayList<String> fileRead = new ArrayList<String>();
   		
   		try 
   		{
   			String lineread = "";
   			
   			
   			BufferedReader bufferedReadIn = new BufferedReader(new FileReader("H:\\Copy of address book//a.txt"));
			while ((lineread = bufferedReadIn.readLine()) != null)
			
			{
				fileRead.add(lineread);
			}
			System.out.println(fileRead.get(3));
			
		for (int fileRead = 0; fileRead <=3; fileRead++)
			System.out.println(fileRead);
			
			
			
			
			//contact a = new contact(textFirstName.getText(), textLastName.getText(),textPhone.getText(), textMob.getText(), textAddress.getText());
   			//people.add(a);
   			
   			//this.tableModel.addRow(new Object[]{a.getFirstName() + " " + a.getLastName(),a.getAddress(),
   			//		a.getHomeNumber(), a.getMobileNumber()});
			
			

			bufferedReadIn.close();
		}	
		
		catch (IOException ex)
		{
			System.out.println("error");
		}
   		
   		
   	}
   	
   	

	public void actionPerformed (ActionEvent e)
   	{
   		
   		if (e.getSource() == buttonExit)
   		{			
   			System.exit(0);
   		}
   		else if (e.getActionCommand().equals("Exit"))
   		{	
   			System.exit(0);
   		}	
   		else if (e.getSource() == buttonSave)
   		{
   			contact c = new contact(textFirstName.getText(), textLastName.getText(),textPhone.getText(), textMob.getText(), textAddress.getText());
   			people.add(c);
   			
   			this.tableModel.addRow(new Object[]{c.getFirstName() + " " + c.getLastName(),c.getAddress(),
   					c.getHomeNumber(), c.getMobileNumber()});
   			saveToFile();
   			
   		}
   		else if (e.getSource() == buttonDelete)
   		{
   			tableModel.removeRow(table.getSelectedRow());
   		} 
   		else if(e.getSource() == buttonSearch)
   		{
   			String text = textFirstName.getText() + textLastName.getText() + textAddress.getText() + textPhone.getText() + textMob.getText();
   			if (text.length() == 0)
   			{
   				sorter.setRowFilter(null);
   			}
   			else
   			{
   				sorter.setRowFilter(RowFilter.regexFilter(text));
   			}
   			
   		}
   		else if (e.getActionCommand().equals("Open"))
   		{
   			JFileChooser chooser = new JFileChooser();
   			if (chooser.showOpenDialog(container1) == JFileChooser.APPROVE_OPTION)
   			{
   				try
   				{
   					BufferedReader file_in = new BufferedReader(
   							new FileReader (chooser.getSelectedFile()));
   				
   					while (true)
   	   				{
   	   					String line = file_in.readLine();
   	   					if(line == null)
   	   						break;
   	   				
   	   				
   	   					this.people.toArray();
   	   				
   	   				}
   				}
   				catch (FileNotFoundException fnfe)
   				{
   					
   				}
   				catch (IOException ioe)
   				{
   					
   				}
   			}
   		}
   		else if (e.getSource() == buttonReset)
   			{
   				this.textFirstName.setText("");
   				this.textLastName.setText("");
   				this.textAddress.setText("");
   				this.textPhone.setText("");
   				this.textMob.setText("");
   			}	
   	}
 }
public class contact 
{
	String firstName;
	String lastName;
	String homeNumber;
	String mobileNumber;
	String address;
	
	public contact (){}
	
	public contact (String fn, String ln, String hn, String mn, String a)
	{
		firstName = fn;
		lastName = ln;
		homeNumber = hn;
		mobileNumber = mn;
		address = a;
		
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getHomeNumber() {
		return homeNumber;
	}

	public void setHomeNumber(String homeNumber) {
		this.homeNumber = homeNumber;
	}

	public String getMobileNumber() {
		return mobileNumber;
	}

	public void setMobileNumber(String mobileNumber) {
		this.mobileNumber = mobileNumber;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	

	
	
}

You should have successfully read the file into the arraylist in the lines 349 - 359.
You now need to separate the lines into groups of four which are the formatted into contact records.
The loop will need to run upto the size of the array, so use

for(int i=0;fileRead.size();i+=4)

You will need to split fileRead into two strings for firstname and lastname
then set

textPhone=fileRead[i+1];
textMob=fileRead[i+2];
textAddress=fileRead[i+3];
contact a = new a contact(textFirstname,textLastname,textPhone,textMob,textAddress);
people.add(a);

You will also need to add the values to the tableModel as per the code commented out.

You should have successfully read the file into the arraylist in the lines 349 - 359.
You now need to separate the lines into groups of four which are the formatted into contact records.
The loop will need to run upto the size of the array, so use

for(int i=0;fileRead.size();i+=4)

You will need to split fileRead into two strings for firstname and lastname
then set

textPhone=fileRead[i+1];
textMob=fileRead[i+2];
textAddress=fileRead[i+3];
contact a = new a contact(textFirstname,textLastname,textPhone,textMob,textAddress);
people.add(a);

You will also need to add the values to the tableModel as per the code commented out.

Thanks so much for your help steve, im still having afew problems tho, on line 397-399 it is saying that the type of expression must be an array type but it resolved it to an arrayList, iv tried changing it from an arrayList to an array but i just get more errors, any idea why?

this is my new section of code....

public void readFromFile () throws Exception
   	{
   		// open file with bufferedreader
   		// while ()
   		//   check 
   		// counter....... number of lines per contact is 4, name,home number, mobile number, address.
   		
   		ArrayList<String> fileRead = new ArrayList<String>();
   		
   		try 
   		{
   			String lineread = "";
   			
   			
   			BufferedReader bufferedReadIn = new BufferedReader(new FileReader("H:\\Copy of address book//a.txt"));
			while ((lineread = bufferedReadIn.readLine()) != null)
			
			{
				fileRead.add(lineread);
				for  (int i = 0; i < fileRead.size(); i+=4)
				{
					textPhone = fileRead [i +1];
					textMob = fileRead[i +2 ];
					textAddress = fileRead[i+3];
				}	
					
					contact a = new contact(textFirstName.getText(), textLastName.getText(),textPhone.getText(), textMob.getText(), textAddress.getText());
		   			people.add(a);
					
					
					
				
					
				
			}
			System.out.println(fileRead.get(0));
			
				
			//contact a = new contact(textFirstName.getText(), textLastName.getText(),textPhone.getText(), textMob.getText(), textAddress.getText());
   			//people.add(a);
   			
   			//this.tableModel.addRow(new Object[]{a.getFirstName() + " " + a.getLastName(),a.getAddress(),
   				//	a.getHomeNumber(), a.getMobileNumber()});
			
			

			bufferedReadIn.close();
		}	
		
		catch (IOException ex)
		{
			System.out.println("error");
		}
   		
   		
   	}

sorry line 22-24 on this code section are the problem areas

Edited 7 Years Ago by hanntaa: forgot code

The problem here is variable typing and I should have checked the type before writing the previous section. You have an ArrayList of strings read in from the file and need to form these into contact objects. Each contact object contains five strings for the record, but you have a number of sets of four strings apiece, the first and last names are combined in the file. You cannot put the strings into JTextFields and so get an error, nor do you want to. You need string variables at this point so create some;

String firstName,lastName,telephone,mob,address;
int space; //used later

then we can assign the ArrayList contents to these

telephone=fileread[i+1];
mob=fileread[i+2];
address=fileread[i+3];

However, we still have to split the first line fileread, I presume you should have been shown String.indexOf() has you need this or something similar to split the String!
Assuming the names consist of only first and last names with both names being single words you can look for the separating space.

firstname=fileread[i];
space=firstname.indexOf(" ");
lastname=firstname.substring(space);
firstname.firstname.substring(0,space);
a=new contact(firstname,lastname,telephone,mob,address);

There are other arguably better ways to do this but this should work.

still having afew problems mate, it doesnt seem to want to use the indexs to get the data.
where i try and assign the data in the indexs to the strings it is still saying "the type of the expression must be an array type but it resolved to an ArrayList<String>

i tried using the .get but that doesnt seem to work, i dont know if im just being really stupid but im bagging my head against the wall atm.

public void readFromFile () throws Exception
   	{
   		// open file with bufferedreader
   		// while ()
   		//   check 
   		// counter....... number of lines per contact is 4, name,home number, mobile number, address.
   		
   		ArrayList<String> fileRead = new ArrayList<String>();
   		
   		try 
   		{
   			String lineread = "";
   			
   			BufferedReader bufferedReadIn = new BufferedReader(new FileReader("H:\\Copy of address book//a.txt"));
			while ((lineread = bufferedReadIn.readLine()) != null)
			
			{
				fileRead.add(lineread);
				
				for  (int i = 0; i < fileRead.size(); i+=4)
				{
					telephone = fileRead[i+1];
					mob2 = fileRead.get(i+2);
					address2 = fileRead.get(i+3);
					firstName = fileRead.get(i);
					space = firstName.indexOf(" ");
					lastName = firstName.substring(0, space);
					
				}	
				
			}
			contact a = new contact(firstName, lastName, telephone, mob2, address2);
			//System.out.println(address);
			
			//System.out.println(fileRead.get(0));
						
			//contact a = new contact(textFirstName.getText(), textLastName.getText(),textPhone.getText(), textMob.getText(), textAddress.getText());
   			//people.add(a);
   			
   			//this.tableModel.addRow(new Object[]{a.getFirstName() + " " + a.getLastName(),a.getAddress(),
   					//a.getHomeNumber(), a.getMobileNumber()});
			
			//System.out.println(a);

			bufferedReadIn.close();
   			
		}	
		
		catch (IOException ex)
		{
			System.out.println("error");
		}
   		
   	}

lines 22-25 are the problem atm

still having afew problems mate, it doesnt seem to want to use the indexs to get the data.
where i try and assign the data in the indexs to the strings it is still saying "the type of the expression must be an array type but it resolved to an ArrayList<String>

i tried using the .get but that doesnt seem to work, i dont know if im just being really stupid but im bagging my head against the wall atm.

public void readFromFile () throws Exception
   	{
   		// open file with bufferedreader
   		// while ()
   		//   check 
   		// counter....... number of lines per contact is 4, name,home number, mobile number, address.
   		
   		ArrayList<String> fileRead = new ArrayList<String>();
   		
   		try 
   		{
   			String lineread = "";
   			
   			BufferedReader bufferedReadIn = new BufferedReader(new FileReader("H:\\Copy of address book//a.txt"));
			while ((lineread = bufferedReadIn.readLine()) != null)
			
			{
				fileRead.add(lineread);
				
				for  (int i = 0; i < fileRead.size(); i+=4)
				{
					telephone = fileRead[i+1];
					mob2 = fileRead.get(i+2);
					address2 = fileRead.get(i+3);
					firstName = fileRead.get(i);
					space = firstName.indexOf(" ");
					lastName = firstName.substring(0, space);
					
				}	
				
			}
			contact a = new contact(firstName, lastName, telephone, mob2, address2);
			//System.out.println(address);
			
			//System.out.println(fileRead.get(0));
						
			//contact a = new contact(textFirstName.getText(), textLastName.getText(),textPhone.getText(), textMob.getText(), textAddress.getText());
   			//people.add(a);
   			
   			//this.tableModel.addRow(new Object[]{a.getFirstName() + " " + a.getLastName(),a.getAddress(),
   					//a.getHomeNumber(), a.getMobileNumber()});
			
			//System.out.println(a);

			bufferedReadIn.close();
   			
		}	
		
		catch (IOException ex)
		{
			System.out.println("error");
		}
   		
   	}

lines 22-25 are the problem atm

think i may have worked out them problem, i have got the name part displaying as long as i comment out the address and phone number parts of the for loop, could it be something to do with the for declaration?? the indexs not being right?

hey iv solved the problem now, seems that the for loop was only reading in one index so i changed the logic abit and got it working :), now to get it to export..........

thanks for all your help

This question has already been answered. Start a new discussion instead.