听你说话,怎么好象是在用C++在coding,java可是OO的语言。java里没有这样的函数,只有用JAVA的方法。
JButton button = new JButton("打开文件");
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
         JFileChooser file = new JFileChooser();
int result = file.showOpenDialog(new JPanel());
if (result ==file.APPROVE_OPTION) 
{
String fileName = file.getSelectedFile().getName();
String dir = file.getCurrentDirectory().toString();
JOptionPane.showConfirmDialog        (null,dir+"\\"+fileName,"选择的文件",JOptionPane.YES_OPTION);        }
}
});