其他分享
首页 > 其他分享> > catch小说内容-从gui到爬虫(3)

catch小说内容-从gui到爬虫(3)

作者:互联网

day4-完善窗体

1.文件选择窗口-Jfilechooser

1) 步骤

2) 代码

   button1.addActionListener(new ActionListener() {
       public void actionPerformed(ActionEvent e) {
           JFileChooser chooser= new JFileChooser(text1.getText());
           chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
           int a = chooser.showSaveDialog(button1);
           if (a == JFileChooser.APPROVE_OPTION) {
               // 如果点击了保存按钮,赋值
               text1.setText(chooser.getSelectedFile().getAbsolutePath());

           }
       }
       });

2. 提示窗口-showMessageDialog

标签:button1,显示文件,gui,chooser,爬虫,ONLY,catch,DIRECTORIES,JFileChooser
来源: https://blog.csdn.net/qq_41940001/article/details/118755339