I am trying to set the size of some of my panels, and since they will all be the same size i thought i could do it using a for loop, in which it loops through the different panels in the array and sets their size.
for example when it is at index 0 then it should have the name of the first panel
i want to set the size for, however i'm not sure how to then get it to extract the word from the variable rather than use the variables name itself as the word?
If you get what Im trying to do here:
String[] array = {"pepperoniPanel", "mozarellaPanel", "hawaiianPanel", "meatXtremePanel"}; for (int i = 0; i < array.length; i++) { String current; current = array[i]; current.setMaximumSize(new Dimension(sizeX, sizeY)); current.setPreferredSize(new Dimension(sizeX, sizeY)); }