java學籍管理系統(tǒng)源代碼_第1頁
java學籍管理系統(tǒng)源代碼_第2頁
java學籍管理系統(tǒng)源代碼_第3頁
已閱讀5頁,還剩4頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領

文檔簡介

1、java學籍管理系統(tǒng)源代碼作者:日期:package zuoye;/主類import java.awt.*;import java.awt.eve nt.*;import javax.swi ng.*;import java.io.*;import java.util.Hashtable;public class Man agerWi ndow exte nds JFrame impleme nts Actio nListe ner InputStudent基本信息錄入=null;ModifySituatio n基本信息修改=n ull;In quest基本信息查詢=nu II;Delete基

2、本信息刪除=n ull;JPa nel pCe nter,p,p9;TextField txtName,txtPassword;Label lblTitle,lblName,lblPassword;Butt on btn Submit,bt nReset,gua nbi;Panel p1,p11,p12,p2,p13,p14,p15;JMenuBar bar;ImageIc on icon;JMe nu fileMe nu;JMenuItem錄入修改,查詢,刪除,歡迎,退出,關于;Container con=n ull;Hashtable 基本信息=n ull;File file=null;C

3、ardLayout card=n ull;JLabel label=null;JLabel label2;public Man agerWi ndow()p=new JPa nel();lblName=new Label("管理員帳號:");txtName=new TextField(10);lblPassword=new Label("密碼:");txtPassword=new TextField(10);txtPassword.setEchoChar('*');btnSubmit = new Button("提交"

4、);btnReset = new Button("重置");gua nbi=new Butt on (” 關閉");p11= new Pan el();p12=new Panel();p13=new Panel();p14=new Pan el();p15=new Pan el();pll.add(lblName);.pll.add(txtName);p12.add(lblPassword);p12.add(txtPassword);txtName.addActio nListe ner(this);txtPassword.addAct ion Liste ner

5、(this);p13.add(bt nSubmit);btn Submit.setBackgrou nd(Color.YELLOW);p13.add(bt nReset);btn Reset.setBackgrou nd(Color.YELLOW);p13.add(gua nbi);gua nbi.setBackgrou nd(Color.YELLOW);btn Submit.addAct ion Liste ner(this);btn Reset.addActi on Liste ner(this);gua nbi.addAct ion Liste ner(this);p.setLayout

6、(new GridLayout(10,1);p.add(p14);p.add(p15);p.add(p11);p.add(p12);p.add(p13);p.setBackgro un d(Color.gray);p9=new JPa nel();icon=new ImageIc on ("123.jpg");label2=new JLabel(ic on, JLabel.LEFT);label=new JLabel("歡迎使用學生基本信息管理系統(tǒng)”,JLabel.CENTER);label.setFont(new Font("TimesRoman&qu

7、ot;,Font.BOLD,24);label.setForegro un d(Color.red);p9.setOpaque(true);p9.add(label);p9.add(label2);錄入=new JMenultem(”錄入學生基本信息”);修改=new JMenultem(”修改學生基本信息”);查詢=new JMenultem(”查詢學生基本信息”);刪除=new JMenultem(”刪除學生基本信息”);歡迎=new JMenuItem("歡迎界面");退出=new JMenultem(” 退出");關于=new JMenultem(”關于我

8、們”);bar=new JMe nuBar();fileMenu=new JMenu("菜單選項");fileMenu.add(錄入);fileMenu.add(修改);fileMenu.add(查詢);fileMenu.add(刪除);fileMenu.add(歡迎);fileMenu.add(關于);fileMenu.add(退出);fileMe nu.en able(false);bar.add(fileMe nu);setJMe nuBar(bar);基本信息=new Hashtable();錄入.addActionListener(this);修改.addActi

9、onListener(this);查詢.addActionListener(this);刪除.addActionListener(this);歡迎.addActionListener(this);退出.addActionListener(this);關于.addActionListener(this);card=new CardLayout();con=getC onten tPa ne();pCe nter=new JPa nel();pCe nter.setLayout(card);pCe nter.setBackgro un d(Color.black);file=new File(&q

10、uot;作業(yè).txt");if(!file.exists()tryFileOutputStream out =new FileOutputStream(file);ObjectOutputStream objectOut =new ObjectOutputStream(out);objectOut.writeObject(基本信息);objectOut.close();out.close();catch(IOExcepti on e)基本信息錄入=n ew In putStude nt(file);基本信息修改=new ModifySituatio n(file);基本信息查詢=ne

11、w Inq uest(this,file);基本信息刪除=new Delete(file);pCe nter.add(p,BorderLayout.CENTER);pCenter.add(”歡迎語界面 ”,p9);pCenter.add(”錄入界面",基本信息錄入);pCenter.add(”修改界面",基本信息修改);pCenter.add("刪除界面",基本信息刪除);con .add(pCe nter,BorderLayout.CENTER);con. validate();addWi ndowListe ner(new Win dowAdapte

12、r() public void win dowClos in g(Wi ndowEve nt e)System.exit(O););setVisible(true);setBou nds(500,200,450,400);validate();public void clear()txtName.setText("");txtPassword.setText("");SuppressWar nin gs("deprecati on")public void submit()String n=txtName.getText();Stri

13、 ng paw=txtPassword.getText();if(n.equals("admin") && paw.equals("1234")JOptionPane.showMessageDialog(this,"合法用戶,歡迎進入本系統(tǒng)");card.show(pCenter,"歡迎語界面”);fileMe nu.e nable();elseJOptionPane.showMessageDialog(this,"非法用戶,禁止進入本系統(tǒng)"); public void acti on P

14、erformed(Act ion Eve nt e) if(e.getSource()=錄入)card.show(pCenter,"錄入界面");else if(e.getSource()=修改)card.show(pCenter,"修改界面");else if(e.getSource()=查詢)基本信息查詢.setVisible(true);else if(e.getSource()=刪除) card.show(pCenter,"刪除界面”);else if(e.getSource()=歡迎)card.show(pCenter,"歡迎語界面");else if(e.getSource()=退出)System.exit(O);else if(e.getSource()=關于)JOptionPane.showMessageDialog(this,"五塊二小組:常永恒,孫東升,李強,吳春 亮,涂留定");String s=e.getActi on Comma nd();if(s.equals("重置")clear();else if(s.eq

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論