jopen.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent e) {
    JFileChooser fileChooser = new JFileChooser();
      fileChooser.setDialogTitle("请选择创建数据库表的文件");
      fileChooser.showOpenDialog(null);
  }
});

解决方案 »

  1.   

    下面可以取到选择的文件
    jopen.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        JFileChooser fileChooser = new JFileChooser();
        fileChooser.setDialogTitle("请选择创建数据库表的文件");
        fileChooser.showOpenDialog(null);
        FileInputStream is = null;
        try {
          is = new FileInputStream(fileChooser.getSelectedFile());
        }
        catch (FileNotFoundException ex) {
          ex.printStackTrace();
        }
        DataInputStream inData = new DataInputStream(is);
      }
    });