?? configreader.java
字號:
import java.util.*;
import java.io.*;
import javax.swing.*;
public class ConfigReader{
private Properties ps;
private String information;
public ConfigReader(String file){
ps = new Properties();
try{
InputStream in = new FileInputStream(file);
ps.load(in);
in.close();
}
catch(FileNotFoundException e){
information = file+"文件未找到!";
}
catch(SecurityException e){
information = file+"文件拒絕訪問!";
}
catch(IOException e){
information = "加載"+file+"文件時發生錯誤!";
}
catch(IllegalArgumentException e){
information = file+"中包含錯誤的 Unicode 轉義序列!";
}
catch(Exception e){
information = "讀取"+file+"文件時發生未知錯誤!";
}
finally{
if(information!=null)
JOptionPane.showMessageDialog(null, information, "出錯提示", JOptionPane.ERROR_MESSAGE);
}
}
public String get(String arg){
return (String)ps.get(arg);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -