点击jButton控件弹出文件对话框

import java.awt.FileDialog;

……
   private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
        FileDialog fdo = new FileDialog(this,"open the file",FileDialog.LOAD);
        fdo.setVisible(true);
        strLoadDir = fdo.getDirectory() + fdo.getFile();
}

……

你可能感兴趣的:(java,文件对话框)