import java.awt.BorderLayout;
import java.awt.Color;import java.awt.Container;import java.awt.event.ActionEvent;import java.io.File;import java.util.ArrayList;import java.util.List;import javax.swing.JComboBox;
import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JList;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTextArea;public class FileUtils extends JFrame{
/** * @param args */ public static String listDirectory(File dir) throws IllegalAccessException{ if(!dir.exists()){ throw new IllegalAccessException("目录"+dir+"不存在"); } if(!dir.isDirectory()){ //判断是不是目录 throw new IllegalArgumentException(dir+"不是目录"); } String[] fileName = dir.list(); String name =""; for(String a : fileName){ name=name+a+"\n";} return name; } public static void main(String[] args) { // TODO Auto-generated method stub JFrame frame=new JFrame(); JPanel main_panel =new JPanel(new BorderLayout()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //frame.setLayout(null); String[] itme =new String[]{ "all",".wav",".au"}; JComboBox box=new JComboBox(); for(int i=0;i
}