听你说话,怎么好象是在用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); }
}
});
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); }
}
});
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货