首页>代码>Java swing简单个人信息管理器>/People/src/com/text1/FileOpe.java
package com.text1;

import java.io.FileReader;
import java.io.PrintStream;
import java.util.Properties;
import javax.swing.JOptionPane;

public class FileOpe {
    private static String fileName="C:\\Program Files\\Java\\eclipse-workspace\\People\\bin\\com\\text1\\cus.inc";
    private static Properties pps;
    static {
        pps=new Properties();
        FileReader reader=null;
        try {
            reader=new FileReader(fileName);
            pps.load(reader);
        }
        catch (Exception ex) {
            JOptionPane.showMessageDialog(null,"文件操作异常");
            System.exit(0);
        }
        finally {
            try {
                reader.close();
            }
            catch (Exception ex) {}
        }
    }
    private static void listInfo() {
        PrintStream ps=null;
        try {
            ps=new PrintStream(fileName);
            pps.list(ps);
        }
        catch (Exception ex) {
            JOptionPane.showMessageDialog(null,"文件操作异常");
            System.exit(0);
        }
        finally {
            try {
                ps.close();
            }
            catch (Exception ex) {}
        }
    }
    public static void getInfoByAccount(String account) {
        String cusInfo=pps.getProperty(account);
        if(cusInfo!=null) {
            String[] infos=cusInfo.split("#");
            Conf.account=account;
            Conf.password=infos[0];
            Conf.name=infos[1];
            Conf.dept=infos[2];
        }
    }
    public static void updateCustomer(String account,String password,String name,String dept) {
        pps.setProperty(account,password+"#"+name+"#"+dept);
        listInfo();
    }
}
最近下载更多
120_wu  LV4 2024年12月3日
YZN111  LV3 2023年12月12日
1219610676  LV4 2023年12月7日
yangxb2  LV10 2023年10月20日
linmou  LV8 2023年3月13日
朱俪的邮件及存储  LV8 2023年2月27日
Willson88888  LV3 2022年12月7日
奶油味儿的小透明  LV1 2022年12月5日
VIOLENTIO  LV1 2022年11月8日
闫小玥  LV8 2021年12月22日
最近浏览更多
pxqtsht  LV16 2月21日
DoustrongWU  LV5 2月16日
120_wu  LV4 2024年12月3日
233002037  LV3 2024年10月20日
uid0901  LV2 2024年3月14日
lshlsh 2023年12月25日
暂无贡献等级
shiaomon 2023年12月14日
暂无贡献等级
YZN111  LV3 2023年12月12日
1219610676  LV4 2023年12月7日
李朝磊  LV18 2023年11月18日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友