I want to make a java program in which there is a combobox which displays the titles of all the files available in a folder
问题 I actually want a JFrame in which there is a combobox. There is a folder which has 3 sound files named: sound1.wav sound2.wav sound3.wav The combobox should display these 3 file titles and when I click one of them it plays that sound file. 回答1: You could simply search the folder and populate the combobox with the values (Example: http://www.exampledepot.com/egs/java.io/GetFiles.html). To play the soundfiles you may want to look here: How can I play sound in Java? 回答2: You can use .listFiles()