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

📄 configreader.java

📁 一个简单的电话本实现代码,可编译通过,界面很简单
💻 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 + -