Hi guys,

I have this mini telephone book assignment that I have to do, but now I'm stuck at this one part and I can't get it figured out.

Just a bit of background on what I have so far in my program:

1. A 'Name and Surname' TextField for the user to insert a persons name and surname.
2. A 'Number' TextField for the user to insert a persons phone number.
3. Add Button - To add a new person and his telephone number.
4. Remove Button - To remove a person along with the telephone number.
5. Retrieve Button - To get the appropriate number of a specific person.
6. View All Entries Button - To display a list of all the names and numbers added so far in a JTable.
7. Clear Textfields - To clear both of the textfields.

I used a TreeMap<String, String> to store the information of the names and numbers input by the user.

I also used Regular Expressions to check if the information are correct which the user has input in the name and number textfields.

* A user may only add a new contact or retrieve a number if the information is in the correct format.
* A user may only remove an entry when the number has been retrieved first.

Now here is my problem that I'm having trouble with:

At point number six (above) - I do not know how to get the information from the TreeMap to get it to display in the JTable,
I have created a method called myTable() which the actionPerformed method for the "View All Entries Button" will call to display the JTable
with all the entries in it.

I'm not sure where exactly the problem is in my code for the 'myTable()' but when I input about five contacts along with their numbers
and click on the "View All Entries Button" no entry is displayed? Why is this?

Code for myTable:

public void myTable() {
    	JFrame frame = new JFrame();
    	frame.setTitle("Phonebook Entries");
        int a = tm.size();
        String columnNames[] = {"Name and Surname", "Phone Number"};
        Object rows[][] = new Object[a][2];
        JTable t = new JTable(rows, columnNames);
        JScrollPane scrollPane = new JScrollPane(t);
        for(Map.Entry entry : tm.entrySet()) {
        t = new JTable(rows, columnNames);
Please Help me out with this.

Thanks in advance