非常模糊的问题。您是说要每行输入一个吗?如果是这样,则要使用BufferedReader之类的东西,请读取所有行,并将它们保存为String数组。创建一个新的JComboBox传入该String构造函数。
BufferedReader input = new BufferedReader(new FileReader(filePath));List<String> strings = new ArrayList<String>();try { String line = null; while (( line = input.readLine()) != null){ strings.add(line); }}catch (FileNotFoundException e) { System.err.println("Error, file " + filePath + " didn't exist.");}finally { input.close();}String[] lineArray = strings.toArray(new String[]{});JComboBox comboBox = new JComboBox(lineArray);


