Mass produce JTables
问题 I want to make 25 JTables. I generate the table names by doing: for(int i=0; i < 26; i++) { TableNames[i] = "Table" + i + ""; ... How can I go about using these String names in the array as the new JTable names? i.e. TableNames[i] = new JTable(model){ ... 回答1: Instead of an array, consider using a List<JTable> or List<TableModel> . Pass the name to the table's constructor or factory method. The example below uses the Component 's name, but a JComponent 's client property may be more versatile