|
|
swing中调用文件选择对话框 |
|
|
作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站 |
import javax.swing.*; . . . public class jCutter extends JFrame { private JTextField textField; private JButton button; private JFileChooser fDialog; private JFrame frame; . . . button = new JButton(); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ String msg; fDialog=new JFileChooser(); //文件选择器 int result=fDialog.showOpenDialog(frame); if(result==JFileChooser.APPROVE_OPTION){ String fname=fDialog.getName(fDialog.getSelectedFile()); frame.setTitle(fname); msg="File Open Approved"; }else msg="File Open Cancelled"; JOptionPane.showMessageDialog(frame,msg); //提示框 } });
|
|
相关文章:相关软件: |
|