I need to create quantity of components n what I do not know, if it is properly written the way I do it
public class cualquierClase{
private JTextArea textAreaTab;
private JTextArea createTextAreaTab(int row, int col, String nameTextArea){
textAreaTab = new JTextArea(row, col);
textAreaTab.setWrapStyleWord(true);
textAreaTab.setSize(200, 250);
textAreaTab.setLineWrap(true);
textAreaTab.setForeground(Color.blue);
textAreaTab.setEditable(false);
textAreaTab.setName("textAreaTab_"+nameTextArea);
if (iteradorDePrueba("textAreaTab_"+nameTextArea)) {
boxes.add(textAreaTab);
}
return textAreaTab;
}
}
By passing the if it will be saved in a list in which I am storing them.
What causes me doubt is if: Does each time you call the method create a new object and keep it in memory so that it does not exceed the if?.