i receive float data from the network every 400 ms that i put in 4 arrays of float. I store those arrays in another array, so i have :
float[][] datas = {data1, data2, data3, data4};
FloatData floatData = new FloatData(datas);
model.addFloatData(floatData);
My model has a list of FloatData object and the FloatData object has the method :
float[] getFloatData(int index);
that returns the array of float that i want. This array is used to paint on a JPanel. So in the painComponent i do the following :
for(FloatData floatData : listOfFloatData) {
floatData.draw(g, index);
}
My question is what kind of list can i use for the listOfFloatData as it will be updated every 400 ms and read in the paintComponent method ? Also, i would like to know a convenient way to pass the listOfFloatData from the model to my view ? I was thinking about using a singleton object holding the listOfFloatData as this list will be used in several components ? Thank you.