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

📄 save.java

📁 模拟实现对windows的记事本多线程查找
💻 JAVA
字号:
import java.io.*;

import javax.swing.*;

public class Save extends Thread{
	public void run(){
		if(FileDialogDemo.jfc.showSaveDialog(new JFileChooser())
				== FileDialogDemo.jfc.APPROVE_OPTION)
		{
			save(FileDialogDemo.jfc.getSelectedFile());
		}
	}
	public static void save(File file){
		try{
			BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file));
			byte[] b = (FileDialogDemo.jta.getText()).getBytes();
			out.write(b,0,b.length);
			out.close();
			FileDialogDemo.lab.setText(file.getName() + "Saved");
		}
		catch (IOException ex){
			FileDialogDemo.lab.setText("Error opening" + file.getName());
		}
	}

}

⌨️ 快捷键说明

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