How do I populate JComboBox from a text file?
问题 How do I populate a JComboBox from a text file? 回答1: Very vague question. Are you saying you want one entry per line? If so you want to use something like a BufferedReader, read all the lines, save them as a String array. Create a new JComboBox passing in that String constructor. 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