




下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、精选优质文档-倾情为你奉上package zuoye;/主类import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.io.*;import java.util.Hashtable;public class ManagerWindow extends JFrame implements ActionListener InputStudent 基本信息录入=null; ModifySituation 基本信息修改=null; Inquest 基本信息查询=null; Delete 基本信息删除=null;
2、 JPanel pCenter,p,p9; TextField txtName,txtPassword; Label lblTitle,lblName,lblPassword; Button btnSubmit,btnReset,guanbi; Panel p1,p11,p12,p2,p13,p14,p15; JMenuBar bar; ImageIcon icon; JMenu fileMenu; JMenuItem 录入,修改,查询,删除,欢迎,退出,关于; Container con=null; Hashtable 基本信息=null; File file=null; CardLayou
3、t card=null; JLabel label=null; JLabel label2; public ManagerWindow() p=new JPanel(); lblName=new Label("管理员帐号:"); txtName=new TextField(10); lblPassword=new Label("密 码:"); txtPassword=new TextField(10); txtPassword.setEchoChar('*'); btnSubmit = new Button("提交")
4、; btnReset = new Button("重置"); guanbi=new Button("关闭"); p11=new Panel(); p12=new Panel(); p13=new Panel(); p14=new Panel(); p15=new Panel(); p11.add(lblName); p11.add(txtName); p12.add(lblPassword); p12.add(txtPassword); txtName.addActionListener(this); txtPassword.addActionListe
5、ner(this); p13.add(btnSubmit); btnSubmit.setBackground(Color.YELLOW); p13.add(btnReset); btnReset.setBackground(Color.YELLOW); p13.add(guanbi); guanbi.setBackground(Color.YELLOW); btnSubmit.addActionListener(this); btnReset.addActionListener(this); guanbi.addActionListener(this); p.setLayout(new Gri
6、dLayout(10,1); p.add(p14); p.add(p15); p.add(p11); p.add(p12); p.add(p13); p.setBackground(Color.gray); p9=new JPanel(); icon=new ImageIcon("123.jpg"); label2=new JLabel(icon,JLabel.LEFT); label=new JLabel("欢迎使用学生基本信息管理系统",JLabel.CENTER); label.setFont(new Font("TimesRoman&q
7、uot;,Font.BOLD,24); label.setForeground(Color.red); p9.setOpaque(true); p9.add(label); p9.add(label2); 录入=new JMenuItem("录入学生基本信息"); 修改=new JMenuItem("修改学生基本信息"); 查询=new JMenuItem("查询学生基本信息"); 删除=new JMenuItem("删除学生基本信息"); 欢迎=new JMenuItem("欢迎界面"); 退
8、出=new JMenuItem("退出"); 关于=new JMenuItem("关于我们"); bar=new JMenuBar(); fileMenu=new JMenu("菜单选项"); fileMenu.add(录入); fileMenu.add(修改); fileMenu.add(查询); fileMenu.add(删除); fileMenu.add(欢迎); fileMenu.add(关于); fileMenu.add(退出); fileMenu.enable(false); bar.add(fileMenu); setJ
9、MenuBar(bar); 基本信息=new Hashtable(); 录入.addActionListener(this); 修改.addActionListener(this); 查询.addActionListener(this); 删除.addActionListener(this); 欢迎.addActionListener(this); 退出.addActionListener(this); 关于.addActionListener(this); card=new CardLayout(); con=getContentPane(); pCenter=new JPanel(); p
10、Center.setLayout(card); pCenter.setBackground(Color.black); file=new File("作业.txt"); if(!file.exists() try FileOutputStream out=new FileOutputStream(file); ObjectOutputStream objectOut=new ObjectOutputStream(out); objectOut.writeObject(基本信息); objectOut.close(); out.close(); catch(IOExcepti
11、on e) 基本信息录入=new InputStudent(file); 基本信息修改=new ModifySituation(file); 基本信息查询=new Inquest(this,file); 基本信息删除=new Delete(file); pCenter.add(p,BorderLayout.CENTER); pCenter.add("欢迎语界面",p9); pCenter.add("录入界面",基本信息录入); pCenter.add("修改界面",基本信息修改); pCenter.add("删除界面&quo
12、t;,基本信息删除); con.add(pCenter,BorderLayout.CENTER); con.validate(); addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) System.exit(0); ); setVisible(true); setBounds(500,200,450,400); validate(); public void clear()txtName.setText("");txtPassword.setText("&qu
13、ot;);SuppressWarnings("deprecation")public void submit()String n=txtName.getText();String paw=txtPassword.getText();if(n.equals("admin") && paw.equals("1234")JOptionPane.showMessageDialog(this,"合法用户,欢迎进入本系统");card.show(pCenter,"欢迎语界面");fileMe
14、nu.enable();elseJOptionPane.showMessageDialog(this,"非法用户,禁止进入本系统");public void actionPerformed(ActionEvent e) if(e.getSource()=录入) card.show(pCenter,"录入界面"); else if(e.getSource()=修改) card.show(pCenter,"修改界面"); else if(e.getSource()=查询) 基本信息查询.setVisible(true); else if(
15、e.getSource()=删除) card.show(pCenter,"删除界面"); else if(e.getSource()=欢迎) card.show(pCenter,"欢迎语界面"); else if(e.getSource()=退出) System.exit(0); else if(e.getSource()=关于) JOptionPane.showMessageDialog(this,"五块二小组:常永恒,孙东升,李强,吴春亮,涂留定"); String s=e.getActionCommand();if(s.equals("重置")clear();else if(s.equals
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 广东防排烟自考试题及答案
- 矿长任职考试题及答案
- 库仑力考试题及答案
- 松脂工技能巩固考核试卷及答案
- 球团原料工岗位操作技能考核试卷及答案
- 2025年中国轻型裁割机数据监测报告
- 飞机桨叶型面仿形工职业考核试卷及答案
- 蒸馏炉工综合考核试卷及答案
- 摊商岗位操作技能考核试卷及答案
- 炼钢浇铸工专项考核试卷及答案
- 建筑培训教学课件
- 学习乐理音程课件
- 爆破安全培训课件
- 管线物探基本知识培训课件
- 医护人员护理文书书写规范模板
- 财务岗招聘笔试题目及答案
- 2025上教师资格笔试考试试题与答案(初中化学考生回忆版)
- 《中国名菜》课程标准
- 感染性腹泻的病例讨论
- 输尿管癌根治术后护理查房
- 《商务数据分析与处理》高职电子商务数据分析全套教学课件
评论
0/150
提交评论