I created an object type arrayList but table still not identifying it as an object and giving error
this is the error it is producing.
no suitable method found for add (object[])
Below is the code is used:
ArrayList<Object> CartItems = new ArrayList<Object>();
cartCheckout.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Cartgui.setVisible(true);
for (int i = 0; i < candyList.size(); i++) {
String name = candyList.get(i).getCandyName();
int weight = candyList.get(i).getweight();
int priceLbs = candyList.get(i).getPriceLbs();
Object[] data = {name, weight, priceLbs};
Cartgui.add(data);//this line is producing error
}
}
});
I expect the output to see name,weight and pricelbs in tabular form in table. cartgui is the tablename