java编写图书馆管理系统内容摘要:

+s8+; )。 int n1=(this, 是否确定添加 ” )。 if(n1==){ /*。 */ String personInfo=/* 学号: +*/s2+\r\n+/* 姓名: +*/s1+\r\n+/* 年龄:+*/s3+\r\n/*+性别: */+s4+\r\n/*+学院: */+s5+\r\n/*+专业: */+s6+\r\n+/*年级:+*/s7+\r\n/*+班级: */+s8+\r\n。 /*用户所有信息 */ byte tom1[]=new byte[1000000]。 tom1=()。 try{ File f=new File(C:\\)。 try { ()。 // 当且仅当不存在具有此抽象路径名指定名称的文件时,不可分地创建一个新的空文件 } catch (IOException e2) { ()。 } FileOutputStream out=new FileOutputStream(f,true)。 /*(tom)。 */ (tom1,0,)。 /*while((b=(tom,0,10000))!=1){ String s=new String(tom,0,b)。 */ (personInfo)。 /*}*/ ()。 /*弹出添加成功的界面 */ (this, 添加成功 !, 通 知 对 话 框,)。 (null)。 (null)。 (null)。 (null)。 (null)。 (null)。 (null)。 (null)。 } catch (IOException ex){ (this, 文件写入错误。 , 警告对话框,)。 /*(File write Error+ex)。 */ } } } } catch(Exception ee){ (this, 学 号 或 年 龄格 式 错 误。 , 警告 对 话框,)。 (null)。 (null)。 ()。 } } /////////////////// } } } import。 import。 import。 import。 import。 import。 import。 import。 import。 import。 import。 import。 import。 import。 import。 import。 import。 import。 import。 import。 import。 import。 import。 public class AddInforFrame extends JFrame implements ActionListener{ static int inforcount=0。 JLabel alable。 /*姓名、学号、年龄、性别、学院、专业、年级、班级 */ JLabel userlable。 JLabel usernumber。 JLabel age。 JLabel sex。 JLabel collage。 JLabel major。 JTextField userinput,usernuminput,ageinput,sexinput,collageinput,majorinput。 JTextArea showtext。 /*用于显示用户添加的信息域 */ JButton ok。 JButton reset。 int flag=0。 int flag1=0。 public AddInforFrame(){ init()。 setBounds(400,100,600,600)。 setVisible(true)。 setResizable(false)。 /* addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ int n=( this, 是否要真的退出添加。 ,确认对话框 , )。 if(n==){。 (0)。 } } })。 */ setDefaultCloseOperation()。 } void init(){ alable =new JLabel(请填写相关信息: )。 userlable=new JLabel(学号: )。 usernumber =new JLabel(编号: )。 age=new JLabel(姓名: )。 sex=new JLabel(书名: )。 collage=new JLabel(借书时间: )。 major=new JLabel(还书时间: )。 userinput=new JTextField(15)。 usernuminput=new JTextField(15)。 ageinput=new JTextField(15)。 sexinput=new JTextField(15)。 collageinput=new JTextField(15)。 majorinput=new JTextField(15)。 //设置盒式布局并添加组件 Box baseBox,boxV1,boxV2,boxV3,boxV4。 (new FlowLayout())。 boxV1=()。 (alable)。 ((30))。 (userlable)。 ((15))。 (usernumber)。 ((15))。 (age)。 ((15))。 (sex)。 ((15))。 (collage)。 ((15))。 ( major)。 boxV2=()。 /*(10)。 */ ((45))。 (userinput)。 ((11))。 (usernuminput)。 ((11))。 (ageinput)。 ((11))。 (sexinput)。 ((11))。 (collageinput)。 ((11))。 (majorinput)。 boxV3=()。 (boxV1)。 (boxV2)。 boxV4=()。 ok=new JButton(确定 )。 reset=new JButton(取消 )。 (this)。 (this)。 (ok)。 (reset)。 baseBox=()。 (boxV3)。 ((20))。 (boxV4)。 showtext=new JTextArea(9,50)。 /*文本域的一些操作 */ (您新添加的借阅信息如下: )。 add(new JScrollPane(showtext))。 (true)。 /*(()).addDocumentListener(this)。 */ add(showtext)。 (baseBox)。 //让输入用户名的文本框获得焦点 ()。 } @Override public void actionPerformed(ActionEvent e) { // TODO Autogenerated method stub if(()==reset){ (您新添加的借阅信息如下: )。 } else if(().isEmpty()||().isEmpty()||().isEmpty()||().isEmpty()||().isEmpty()||().isEmpty()){ (this, 请 把 信 息 填 写 完 整。 , 警告对话框,)。 } else{ /*此时用户已存在了 */ String usernum=()。 int b。 byte tom[]=new byte[1000000]。 File file=new File(C:\\)。 try{ FileReader in=new FileReader(file)。 BufferedReader inTwo=new BufferedReader(in)。 String s=null。 int a。 while((s=())!=null){ if((a=(usernum))!=1){ flag=1。 (this, 借 阅 已 经 存 在。 , 警告对话框,)。 (null)。 (null)。 (null)。 (null)。 (null)。 (null)。 break。 } } } catch(IOException e1){ (this, 文 件 读 取 失 败。 , 警告对话框,)。 } if(flag==0){ try{ int n=(())。 int m=(())。 String date1=()。 String date2=()。 String eL = [09]{4}[01][09][03][09]。 Pattern p = (eL)。 Matcher mm = (date1)。 Matcher nn=(date2)。 boolean dateFlag = (()amp。 amp。 ())。 if (!dateFlag) { (null)。 (null)。 flag1=1。 (this, 日期格式有误。 , 警告对话框,)。 } if(flag1==0){ inforcount++。 /*计数总人数 */ String s1=()。 (\n+学号: +s1+; )。 String s2=()。 (编号: +s2+; )。 String s3=()。 (姓名: +s3+; )。 String s4=()。 (书名: +s4+; +\n)。 String s5=()。 (借书时间: +s5+; )。 String s6= ()。 (还书时间: +s6+; )。 int n1=(this, 是 否 要 真 的 添 加。 , 确 认 对 话 框 , )。 if(n1==){ /*。 */ String personInfo=/*学号: +*/s1+\r\n+/*姓名: +*/s2+\r\n+/*年龄: +*/s3+\r\n/*+性别:*/+s4+\r\n/*+学院: */+s5+\r\n+/*专业: */s6+\r\n。 byte tom1[]=new byte[1000000]。 tom1=()。 try{ File f=new File(C:\\)。 try { ()。 // 当且仅当不存在具有此抽象路径名指定名称的文件时,不可分地创建一个新的空文件 } catch (IOException e2) { ()。 } FileOutputStream out=new FileOutputStream(f,true)。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。