




下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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年工程法规考试考试流程与规则解读试题及答案
- 高级审计师的职能与价值试题及答案
- 2025年绿色建筑材料市场推广策略与政策支持下的绿色建筑产业链协同发展研究报告
- 行政管理与经济法的交集试题及答案
- 工业互联网平台网络隔离技术在智能安防监控系统2025年应用前景报告
- 社会结构变迁与婚姻观念的关系试题及答案
- 2025年建筑法规考试的方式多样化与试题
- 企业会计实务试题及答案技巧
- 基于2025年的跨境电商零售进口数据:市场规模与发展动态报告
- 抖音商务BD培训
- 虚拟现实与非遗传承
- 中马钦州产业园管委会笔试试题
- 中药处方培训课件
- (高清版)DB12∕T 934-2020 公路工程资料管理技术规程
- 防火门工程验收单模板
- 施工现场洒水降尘制度及措施
- 企业文化-电力与能源战略参考题库2025版
- T-DZJN 377-2024 数据中心基础设施健康程度评价规范
- 住宅老旧电梯更新改造方案
- 预防未成年人犯罪课件
评论
0/150
提交评论