FileInputStream fis=new FileInputStream(file); 这句也有错吗?数据流问题吗?
private AbstractButton createOpenButton() {
AbstractButton button = createToolBarButton("open.gif");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFileChooser chooser = new JFileChooser();
new JFileChooser().showOpenDialog(MainFrame.this);
int returnVal = chooser.showOpenDialog(getParent());
if(returnVal == JFileChooser.APPROVE_OPTION) {
System.out.println("You chose to open this file: "
+ chooser.getSelectedFile().getName()
+chooser.getSelectedFile().getPath());
}
File file=new File(chooser.getSelectedFile().getName());
if(file.exists()==true)
{ FileInputStream fis=new FileInputStream(file);
}
}
});
return button;
}
问题点数:0、回复次数:0Top




