I just can't seem to return the variable data
in this method:
public Object[] populateTable(ArrayList<Outlet> outletList, String selection){
Object[] data;
for(int i = 0; i<outletList.size(); i++){
if(outletList.get(i).getCity().equalsIgnoreCase(selection)){
if(outletList.get(i).getStatus().equals("ACTIVE")){
String bar = outletList.get(i).getBarangay();
String code = Integer.toString(outletList.get(i).getCode());
String name = outletList.get(i).getName();
data = {bar, code, name};
}
}
}
return data;
}
Netbeans is saying illegal start of expression. Is there a way to execute this method wherein data (coming from a mysql database transferred to a ArrayList<object>
in an interface) is passed to an Object[]
? Finding a way to populate JTable
rows with data coming from a mysql database.