📄 open.java
字号:
import java.io.*;
import javax.swing.*;
public class Open extends Thread{
public void run(){
if(FileDialogDemo.jfc.showOpenDialog(new JFileChooser())
== FileDialogDemo.jfc.APPROVE_OPTION)
{
open(FileDialogDemo.jfc.getSelectedFile());
}
}
public static void open(File file){
try{
BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
byte[] b = new byte[in.available()];
in.read(b,0,b.length);
FileDialogDemo.jta.append(new String(b,0,b.length));
in.close();
FileDialogDemo.lab.setText(file.getName() + "Opened");
}
catch(IOException ex){
FileDialogDemo.lab.setText("Error opening" + file.getName());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -