⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deletealldialog.java~27~

📁 最近在新浪"读书频道"下载了一个小说,有40多个页面,后缀全是shtml的,发现改成html就可以在本地看了,但改起来太麻烦,就写了这个程序,专门用来批量修改某目录下的文件后缀.
💻 JAVA~27~
字号:
package changeExts;import java.awt.*;import javax.swing.*;import java.awt.event.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class DeleteAllDialog extends JDialog {  ChangeExts changeExts;  String strDir,strExts;  JPanel panel1 = new JPanel();  JLabel jLabel1 = new JLabel();  JLabel jLabel2 = new JLabel();  FlowLayout flowLayout1 = new FlowLayout();  JButton jButton1 = new JButton();  JButton jButton2 = new JButton();  public DeleteAllDialog() {  }  public DeleteAllDialog(ChangeExts chExts) {    try {      changeExts=chExts;      jbInit();      pack();    }    catch(Exception ex) {      ex.printStackTrace();    }  }  //public DeleteAllDialog() {    //this(null, "", false);  //}  private void jbInit() throws Exception {    panel1.setLayout(flowLayout1);    jLabel1.setText("");    jLabel1.setVerticalAlignment(SwingConstants.TOP);    jLabel1.setVerticalTextPosition(SwingConstants.CENTER);    jLabel2.setText("");    jLabel2.setVerticalAlignment(SwingConstants.TOP);    jButton1.setActionCommand("ok");    jButton1.setText("ok");    jButton1.setVerticalAlignment(SwingConstants.CENTER);    jButton1.addActionListener(new DeleteAllDialog_jButton1_actionAdapter(this));    jButton2.setText("cancel");    jButton2.addActionListener(new DeleteAllDialog_jButton2_actionAdapter(this));    this.setTitle("Delete all same type files");    panel1.add(jLabel1, null);    panel1.add(jLabel2, null);    panel1.add(jButton1, null);    panel1.add(jButton2, null);    getContentPane().add(panel1);    strDir=changeExts.getFDir();    strExts=changeExts.getFExts();    String str1,str2;    if(strDir!=null&&strExts!=null){      str1="您确实要删除\" "+strDir+"\\\" 下的所有 \""+strExts;      str2="\" 类型文件吗?";    }    else{      str1="请先选择你要删除的文件,再执行这一步操作!";      str2="";    }    jLabel1.setText(str1);    jLabel2.setText(str2);  }  void jButton2_actionPerformed(ActionEvent e) {    this.dispose();  }  void jButton1_actionPerformed(ActionEvent e) {    if(strDir!=null&&strExts!=null){      Strategy strategy3=new CStrategy3(changeExts);      strategy3.read(strDir,strExts,null);      strategy3.save();      this.dispose();    }else{      this.dispose();    }  }}class DeleteAllDialog_jButton2_actionAdapter implements java.awt.event.ActionListener {  DeleteAllDialog adaptee;  DeleteAllDialog_jButton2_actionAdapter(DeleteAllDialog adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton2_actionPerformed(e);  }}class DeleteAllDialog_jButton1_actionAdapter implements java.awt.event.ActionListener {  DeleteAllDialog adaptee;  DeleteAllDialog_jButton1_actionAdapter(DeleteAllDialog adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton1_actionPerformed(e);  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -