I need to create a new JComboBox, but since I'm using the same JFrame for three different operations, I would need to pass the JComboBox name as a parameter
This is the code I have right now:
comboTipo=("Tienda."+tablaP+"Items");
tipo = new JComboBox(comboTipo);
If I print comboTipo I can read "Tienda.telasItems" or "Tienda.accesoriosItems" or "Tienda.aviosItems". I'm looking to use this text into the combo box declaration so I don't have to create a decision structure
Please let me know if additional information is required.
You can't access variables through strings directly in Java (not without reflection which doesn't make much sense here), you are trying to do something which is not allowed.
You should solve problem with a different approach, for example you could use an array:
Object[][] data = new Object[][]{Tienda.telasItems, Tienda.accesoriosItems, Tienda.aviosItems};
JComboBox[] boxes = new JComboBox[3];
for (int i = 0; i < boxes.length; ++i)
boxes[i] = new JComboBox(data[i]);