Hi frends

Here problem with cast from Customer class to Vector



       Vector<Customer> datas = all.tableModel.getDataVector();

        //   Vector<Customer> datas = (Vector<Customer>) 
all.jTable1.getModel();




    public Object[][] refreshAllCustPan(){

               String newData[][];

        //** 1 Create a 2-dimensional string array with no of rows
        //**   equal to custs.length and no of columns set to 3, i
        //**   and assign to newData.

        newData = new String[datas.size()][44];

        //** 2 Write a for loop to populate the newData array with
        //**   customer id, name, and addr obtained from custs array

         for (int i=0; i < datas.size(); i++) {
           newData[i][0] =datas.get(i).getId().toString();
            newData[i][1] = datas.get(i).getName();
            newData[i][2] = datas.get(i).getAddr();
         }
        return newData;
    }


Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: 
java.util.Vector cannot be cast to my.org.entity.Customer
        at 
trader.gui.TableFilterDemo$MyTableModel.refreshAllCustPan(TableFilterDemo.java:193)

Thanks for suggestions.





--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to