我在Windows平台上编写了一个很大的程序,但现在我把我的项目移到了Mac上。在这两个平台上我都使用了eclipse,但是JFilechooser在我的mac上不起作用!!
我的JFilechooser功能:
protected Shell shlGui;
Button btnOpen = new Button(shlGui, SWT.NONE);
btnOpen.addActionListener(new ActionListener() {
@Override
public void widgetSelected(ActionEvent e) {
JFileChooser jfc = new JFileChooser();
if(jfc.showOpenDialog(jfc) == JFileChooser.APPROVE_OPTION){
//get selected file name [i.e., complete file path]
java.io.File f = jfc.getSelectedFile();
txt_open.setText(f.toString());
file_path = f.toString();
image_resize(lbl_image, f.toString());
lbl_image.setImage(new Image(display, "saved.png"));;
}
}
});