日期:2014-05-20 浏览次数:20607 次
import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.table.DefaultTableModel; public class ListCustomTypeFile extends JFrame { private JPanel contentPane = new JPanel(new GridLayout(3,1)); private JLabel URILabel = new JLabel(); private JButton chooserButton = new JButton("选择文件夹"); private JLabel messLabel = new JLabel("载入指定文件扩展名称"); private JTextField nameTextFile = new JTextField(); private JScrollPane scroolPane = new JScrollPane(); private JTable table =new JTable(); private DefaultTableModel tableModel = new DefaultTableModel(); public ListCustomTypeFile() { this.setTitle("显示指定类型的文件"); this.setVisible(true); this.setLocationRelativeTo(null); this.setSize(650, 550); this.setContentPane(contentPane); contentPane.setBorder(new EmptyBorder(5,5,5,5)); JPanel panel1 = new JPanel(new GridLayout(1,2)); panel1.add(chooserButton); panel1.add(URILabel); contentPane.add(panel1); JPanel panel2 = new JPanel(new GridLayout(1,2)); panel2.add(messLabel); panel2.add(nameTextFile); contentPane.add(panel2); JPanel panel3 = new JPanel(new BorderLayout()); panel2.add(scroolPane,BorderLayout.CENTER); scroolPane.setViewportView(table); } public static void main(String[] args) { // TODO Auto-generated method stub new ListCustomTypeFile(); }