I'm trying to populate a JTable with data from a map that contains Strings and floats. Here is how I'm trying to do it, but I get the same data over and over.
private JTable buildTable(Map<String, Float> mapData){
String columnNames[] = { "MyString", "MyFloat" };
Object[][] data = new Object[mapData.size()][2];
for(int i = 0; i < mapData.size(); i++){
for(Map.Entry<String, Float> entry : mapData.entrySet()){
data[i][0] = entry.getKey();
data[i][1] = entry.getValue().getMyFloat();
break;
}
}
JTable table = new JTable(data, columnNames);
return table;
}